Python Tutorial: Itertools Module - Iterator Functions for Efficient Looping

Sdílet
Vložit
  • čas přidán 12. 11. 2018
  • In this Python Programming Tutorial, we will be learning about the itertools module. The itertools module is a collection of functions that allows us to work with iterators in an efficient way. Depending on your problem, this can save you a lot of memory and also a lot of work. Let's get started...
    Functions Covered in This Video:
    count - 1:19
    zip_longest - 6:48
    cycle - 9:17
    repeat - 11:09
    starmap - 14:06
    combinations - 15:34
    permutations - 15:34
    product - 19:45
    chain - 21:40
    islice - 23:37
    compress - 28:50
    filterfalse - 31:49
    dropwhile - 32:24
    takewhile - 32:24
    accumulate - 34:54
    groupby - 37:04
    tee - 43:28
    The code from this video can be found at:
    github.com/CoreyMSchafer/code...
    Iterators Tutorial:
    • Python Tutorial: Itera...
    Sorting Tutorial:
    • Python Tutorial: Sorti...
    ✅ Support My Channel Through Patreon:
    / coreyms
    ✅ Become a Channel Member:
    / @coreyms
    ✅ One-Time Contribution Through PayPal:
    goo.gl/649HFY
    ✅ Cryptocurrency Donations:
    Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
    Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
    Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
    ✅ Corey's Public Amazon Wishlist
    a.co/inIyro1
    ✅ Equipment I Use and Books I Recommend:
    www.amazon.com/shop/coreyschafer
    ▶️ You Can Find Me On:
    My Website - coreyms.com/
    My Second Channel - / coreymschafer
    Facebook - / coreymschafer
    Twitter - / coreymschafer
    Instagram - / coreymschafer
    #Python #Itertools

Komentáře • 238

  • @wolfisraging
    @wolfisraging Před 5 lety +235

    U r seriously a world class teacher
    Thanks man

  • @festivalofcolorsholinyc9031

    tee is like a T is a pipe (like with fluid in it). It's an analogy with unix piping.
    On *nix you can:
    Command1 | tee file.txt | command2
    And it will pipe the output of command1 to tee which will write it to the file 'file.txt' and in turn pipe it to command2.

  • @lowyieldbondfunds
    @lowyieldbondfunds Před 5 lety +3

    One of the most concise lessons about itertools in Python. Thanks Corey!

  • @medi7573
    @medi7573 Před 5 lety +36

    Best python on youtube ,and even away better than paid courses ,thanks man.

  • @VikasGuptacherie
    @VikasGuptacherie Před 5 lety +5

    One thing that I like about this channel is the right pace in which video moves...

  • @greob
    @greob Před 5 lety +63

    Nice and clear demonstration, as always. Thanks!
    44:41 yep, sounds like it comes from the Linux tee program. It comes from the fact that it splits the output into two, like a T shaped pipe.

    • @coreyms
      @coreyms  Před 5 lety +10

      Oh interesting. Thanks!

    • @DavidTangye
      @DavidTangye Před rokem

      @@coreyms it actually predates linux, coming from quite early unix, as do most linux commands and internal shell commands. ps This is another truly excellent leaning video.

  • @marcd4144
    @marcd4144 Před 5 lety +2

    This is probably the best itertools instructional on video... What a useful module! Very good job!

  • @programmer4833
    @programmer4833 Před 4 lety +3

    Incredible video ! I love is when he says : 'If you don't know smth' and then explains it, as I am used to getting a link to another video or no explanation at all. I learned so many things !

  • @Pheshen
    @Pheshen Před 3 lety +2

    I'm learning and using courses and tutorials almost all my life. And I can say with certainty - Corey is brilliant at teaching!

  • @ritzg98
    @ritzg98 Před 2 lety

    This is the best description/explanation of itertools that I have seen.
    Thank you so much for this video.

  • @josephomondi629
    @josephomondi629 Před měsícem +1

    man, I dont' even know how to thank you enough....this is such a good tutorial.

  • @Lu_Ca
    @Lu_Ca Před 5 lety +19

    best itertools tutorial, should be in the official page imo

    • @rautermann
      @rautermann Před 4 lety +1

      Yes. I'm glad I found that explanation for the groupby function. Official documentation on this is unreadable.

  • @lalu225
    @lalu225 Před 5 lety +5

    Fantastic, very well explained and I learned something new. Thank you!

  • @DoFlamingo_1P
    @DoFlamingo_1P Před 5 lety

    i've watched this two times now, its just nicely explained and crafted . Thoroughly enjoyed it .

  • @ibekwevictor1158
    @ibekwevictor1158 Před rokem +3

    The best youtube teacher you can ever think of... Thanks for the Tutorial sir...

  • @Puppysacks
    @Puppysacks Před 5 lety +1

    Hi, I’m new to your channel and I’d rlly like to say thank you for making these videos! It has rlly given me the encouragement I needed to continue to learn. The way you walk us through the process, to where it’s easy enough for a beginner like me, I’m grateful.

  • @MinkoTerziyski
    @MinkoTerziyski Před 5 lety +1

    I don't know, why you sharing all this knowledge, but I am extremely, extremely thankful!

  • @sumaryze
    @sumaryze Před 2 lety +2

    Hands down the best education video on python itertools

  • @abhishekshetty8962
    @abhishekshetty8962 Před 3 lety

    ur way is simple but greatly effective and the examples just make it look soo easy and help to remember it longer

  • @karanagarwal282
    @karanagarwal282 Před 3 lety +22

    The first thing to do after getting a job: Become a Patreon for this channel

  • @AM-cw9wg
    @AM-cw9wg Před 2 lety

    I am really grateful for these tutorials. Thank u.

  • @Adi-xy8iu
    @Adi-xy8iu Před 4 lety +2

    You cleared all my doubts in itertools.
    Thank You

  • @darkbanditEX
    @darkbanditEX Před 3 lety

    This video had great content and every second was worth watching.
    Thanks you for the video Corey.

  • @prakharprakashverma2409
    @prakharprakashverma2409 Před 2 lety +3

    I've seen python videos of many tutors on CZcams but Corey and Navin (from the Telusko channel) are my favorites. Both are amazing teachers ❤❤

  • @jfr9964
    @jfr9964 Před 5 lety +2

    Hey, just want to say that I self-learned Python and your videos were a great help to me when I first started out. Now, I just remembered the channel and came over to see whether it still continues, and your teaching quality has somehow yet improved! Many thanks, and please keep doing this. I learned a lot in this video even though I already knew itertools. Thanks again, and cheers to many more lessons!

  • @JassimBjj
    @JassimBjj Před 5 lety +8

    Hey, Corey, I'm a python beginner and I've started watching your python tutorials a few days ago. And I just wanted to tell you that you're a great teacher. I wish that I had found out about you 3 months ago when I started. I'm a Treehouse student, I like it there but they don't really explain as well as you do. So thank you, Corey, I appreciate your great work.

    • @coreyms
      @coreyms  Před 5 lety

      Thanks!

    • @Ocelot911
      @Ocelot911 Před 5 lety

      yeah bro once you do the treehouse beginner just quit it - it's not worth it

  • @IdanRefaeli3
    @IdanRefaeli3 Před 5 lety +2

    Such a high standard video! Appreciated!

  • @johannes-euquerofalaralema4374

    Awesome! I have learned so much on your channel! Thank you!! You have a gift that not many people have!

  • @chris-vecchio
    @chris-vecchio Před 5 lety +1

    Thanks for the great tutorial and practical examples for each function.

  • @colonelkob
    @colonelkob Před 5 lety +1

    Awesome tutorial, your so thorough in your videos, thanks Man 👊

  • @opiyosebastian50
    @opiyosebastian50 Před 5 lety +1

    Always the best....Good job Corey!

  • @CharlesDibsdale
    @CharlesDibsdale Před 5 lety +1

    Just brilliant. Thanks Corey

  • @vitalik100500q
    @vitalik100500q Před 4 lety +3

    Thanks for the helpful video. English is a foreign language for me, but you speak and explain very clearly.

  • @ryanmcferrell556
    @ryanmcferrell556 Před 5 lety +1

    Thank you very much! You are describing so clear and understandable!

  • @BasicallySteve23
    @BasicallySteve23 Před 5 lety +1

    Great video! These are some seriously useful tools.

  • @Boscovich1er
    @Boscovich1er Před 2 lety

    Excellent video! Thanks for sharing

  • @imransuleiman2684
    @imransuleiman2684 Před 5 lety +1

    Thanks man. we thank you for sharing this invaluable knowledge with us

  • @sleepingzzzen
    @sleepingzzzen Před 3 lety

    Golden videos, thank you very much!

  • @kai-luenliang6565
    @kai-luenliang6565 Před 3 lety

    Wow, thank you...that was the best explanation the itertools ever!

  • @thebuggser2752
    @thebuggser2752 Před 2 lety

    Great presentation of some heavy concepts. Thanks!

  • @himanshumaithani8499
    @himanshumaithani8499 Před 10 měsíci

    Wow! Great Python course. Thanks a lot, brother...

  • @johnathaningle8812
    @johnathaningle8812 Před 5 lety +1

    Thank you so much for your all your work. You are the best teacher ever :)

  • @shikhargupta7552
    @shikhargupta7552 Před 3 lety +1

    Dude, simply excellent 🙏🙏

  • @khachatur2000
    @khachatur2000 Před 5 lety +2

    Thank you a lot for tutorial and timing. It is very useful.

  • @pylvr8021
    @pylvr8021 Před 5 lety +1

    thanks corey , can t wait your next video

  • @UncleLoren
    @UncleLoren Před 3 lety +1

    This is an excellent video. Thank you, Corey! Sure, there are alternative (but more verbose) ways of carrying out many of these operations using "base python" But in the same way that comprehensions allow one to get away with writing less loops, it's the expressiveness of itertools that has me sold. As a pandas user, it was also interesting to pick up some new ideas about how 'groupby'/grouper objects can be used.

  • @cbaxtermusic
    @cbaxtermusic Před 5 lety +4

    just when you think you got the hang of this stuff you explode my mind lol great video man!!!!!!

  • @TheBhartiyaTrainee
    @TheBhartiyaTrainee Před 3 lety

    Apart from being the gold standard python videos, your videos also serve as the video documentation!!

  • @Worldnme
    @Worldnme Před 3 lety

    You are actually really good in teaching also the way you talk is so understandable for me and it's simple so keep up

  • @ashishm8850
    @ashishm8850 Před 5 lety +2

    With Corey, perfection is the norm. Thanks!

  • @cooleekova
    @cooleekova Před 2 lety

    Thank you very much for this video and for all of your work!

  • @netuse4956
    @netuse4956 Před 4 lety

    comprehensive ,excellent explanation ,, loved it

  • @GodsNode
    @GodsNode Před 5 lety +1

    Great video as always, buddy.

  • @karanh874
    @karanh874 Před 3 lety

    You are amazing Corey

  • @kevinduigou3212
    @kevinduigou3212 Před 5 lety +1

    Thank you from France!

  • @muthuhari8875
    @muthuhari8875 Před 5 lety +105

    Hi Corey please do videos about async in python

  • @yeshwanthallampati9460

    Thanks a lot Corey !

  • @ferenclippai1059
    @ferenclippai1059 Před 4 lety

    Youre a great teacher. Keep the content coming! :)

  • @SheilaHer
    @SheilaHer Před 5 lety +2

    COREY! YOU'RE AWESOME!!! I'M SUBSCRIBED!!!

  • @adithyabhat4770
    @adithyabhat4770 Před 4 lety +1

    Great tutoial

  • @frenamakenson9844
    @frenamakenson9844 Před 3 měsíci +1

    thank you for sharing man, very usefull

  • @nawendusingh2858
    @nawendusingh2858 Před 5 lety +1

    200k congrats !!!!!

  • @donsurlylyte
    @donsurlylyte Před 4 lety

    really useful tools, TY

  • @vinamraagrawal8672
    @vinamraagrawal8672 Před 3 lety +1

    Nobody in this planet could have explained better than you. Keep up your good work. Just a small request, if you could break your python playlist in small categories it would make related videos easy to find.

  • @swarupsarangi734
    @swarupsarangi734 Před 2 lety

    This Guy is the best Python Teacher ever. I learnt Python from his Videos. I hope you r fine since I don't see any latest videos.

  • @sociologie4507
    @sociologie4507 Před 5 lety +1

    good job Corey!

  • @aryan7069_
    @aryan7069_ Před 3 lety

    perfectly explained !!! Thanks a lot sir

  • @neerajkulkarni6506
    @neerajkulkarni6506 Před 3 lety +1

    I love iterators!

  • @vinayr1775
    @vinayr1775 Před 3 lety

    Lots of Love, Saved my sleep.

  • @neerajbansal2613
    @neerajbansal2613 Před 4 lety +1

    Thanks , very helpful.

  • @manometer7854
    @manometer7854 Před 5 lety +1

    Amazing teach video! Wow!

  • @mehrzad3424
    @mehrzad3424 Před 2 lety

    it's great ... Thanks man 🍏

  • @yem.t.3930
    @yem.t.3930 Před 2 lety

    Thank you so much!

  • @markwiygul6356
    @markwiygul6356 Před rokem

    Thanks, Awesome!!

  • @hopnguyen3177
    @hopnguyen3177 Před 3 lety

    Thank you very much. From VietNam

  • @Gusio8
    @Gusio8 Před rokem

    Thanks Nice toutrial

  • @sathishtv3068
    @sathishtv3068 Před 5 měsíci

    love it bro..

  • @umaraftab6073
    @umaraftab6073 Před 5 lety +1

    Like first, watch later!
    Thanks for everything, Corey.
    Will you ever be doing a tutorial on python encoding/decoding?

  • @damodargoud6263
    @damodargoud6263 Před 4 lety +2

    thanks corey .

  • @slickwillie3376
    @slickwillie3376 Před 4 lety +5

    The 'tee' fn may refer to a 'tee' fitting in plumbing, which forks off into two directions.

  • @iamtimmo
    @iamtimmo Před 5 lety +9

    “Tee” almost certainly comes from the Unix/Linux command of the same name. The name plays on the Unix concept of pipes as I/O plumbing and represents a tee plumbing fitting[1] that divides a single incoming flow into two or more output flows (in plumbing, it can do the opposite, too, and combine multiples into one). In the Unix case, tee takes input on STDIN and outputs it to both STDOUT and the file (or files) given as its arguments.
    [1] en.m.wikipedia.org/wiki/Piping_and_plumbing_fitting#Tee

  • @mrpuppeteer2834
    @mrpuppeteer2834 Před 3 lety +1

    Thank you very much for covering this topic. I deeply appreciate it. Everything was covered in detail..
    Was thinking about the group by() function lately. It makes no sense that the items have got to be listed in order for the grouping to work..
    Wish the they could add more functionality to the groupby

  • @s.baskaravishnu22
    @s.baskaravishnu22 Před 3 lety

    Many thanks

  • @VV-om8vv
    @VV-om8vv Před rokem

    Perfect thanks

  • @vasudev16180
    @vasudev16180 Před 5 lety +9

    Wow corey ...Love you from India

  • @mrpuppeteer2834
    @mrpuppeteer2834 Před 3 lety

    Thank you so so much..

  • @patnamgnanasai6014
    @patnamgnanasai6014 Před 7 měsíci

    THANKS MAN💌

  • @mankan3765
    @mankan3765 Před 5 lety +1

    Ur videos are awsome

  • @tysontakayushi8394
    @tysontakayushi8394 Před 3 lety

    I know most of them, but it was very nice to see other examples. Very nice video! Could you do something like this with the re or with the collections library?

  • @purna3595
    @purna3595 Před 5 lety +1

    Hi Corey Schafer,you are simply awesome ,Can you please do lectures on searching and sorting algorithms using python

  • @desmondadefon6116
    @desmondadefon6116 Před 5 lety

    Thanks you so much Corey Schafer
    please can you do a video in Threading, and sockects? Thanks so much for the good works u have been doing

  • @1b0o0
    @1b0o0 Před 5 lety +2

    Hi Corey!
    Are you planning on tackling data science stuff like Matplotlib, Pandas, Numpy, Keras, etc?
    I find your vids of tremendous value. Keep'em coming!

    • @abail7010
      @abail7010 Před 5 lety

      For a very good Keras Tutorial including the math behind machine learning (only if you're interested in, its not necessary) , have a look at the deeplizard playlists! It helped me a lot!

  • @ihateorangecat
    @ihateorangecat Před 2 lety +1

    thank you sir🤍🙏

  • @dennisasamoah2213
    @dennisasamoah2213 Před 4 lety +1

    great content

  • @kimeiga
    @kimeiga Před 4 lety +3

    this language is incredible

  • @davidpuliti
    @davidpuliti Před 5 lety +1

    Corey, I believe the tee function comes from Unix and the idea of pipes. If you want to split the flow, you put a “T” pipe in the middle which would output 2 streams. Think plumbing. Thanks for the video.

    • @CharlesDibsdale
      @CharlesDibsdale Před 5 lety

      In the UK there is a term where you can ‘tee off’ from a pipe when you add a new pipe branch. Nothing to do with golfing

  • @ahmedjumaah9727
    @ahmedjumaah9727 Před 4 lety +1

    Hi Corey, thanks for the valuable resources you are providing. Could you please make a video on collections and their use in dictionary. Thank you

  • @Wowthatsfail
    @Wowthatsfail Před 5 lety +1

    Thank you sir

  • @deepak1725
    @deepak1725 Před 5 lety +1

    Superb

  • @pythonlearning1932
    @pythonlearning1932 Před 4 lety

    wondeful corey, BTW, tee command in unix is used to route the output bothe to stdin and to a file(like logging) at the same time