Map, Filter, and Reduce Functions || Python Tutorial || Learn Python Programming

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ม.ค. 2025

ความคิดเห็น • 576

  • @Socratica
    @Socratica  2 ปีที่แล้ว +8

    Wear a Socratica Python shirt for good luck coding: shop.socratica.com/products/python-by-socratica

  • @Socratica
    @Socratica  5 ปีที่แล้ว +123

    It's official! The Socratica Python Kickstarter was a success! Thank you to all of our supporters. Because of you, many more Python videos coming soon!! 💜🦉

  • @kailashprasad1137
    @kailashprasad1137 7 ปีที่แล้ว +1271

    Python should be a comedian because it is full of one liners.

    • @abbysands9510
      @abbysands9510 7 ปีที่แล้ว +2

      lol

    • @Chiramisudo
      @Chiramisudo 6 ปีที่แล้ว +22

      A Map, a Filter, and a Reduce walk into a compiler... >.< Ugh! Obviously I should NOT be a comedian, lol.

    • @practicecomputing8506
      @practicecomputing8506 5 ปีที่แล้ว +19

      1:40 "If brevity is the soul of wit, then python is in a class by itself"

    • @JoeWong81
      @JoeWong81 5 ปีที่แล้ว +24

      The language itself was named after monty python

    • @salyoshkin
      @salyoshkin 5 ปีที่แล้ว +4

      Still too long. What in python you write in 1 line, in R you do in couple of symbols

  • @Terniedintorni
    @Terniedintorni 5 ปีที่แล้ว +44

    I am currently attending a university master in data science. These videos are 100 times Better than the slides I got from my professor. Clear and Easy to apply. Thank you

    • @anonymous-wd7pb
      @anonymous-wd7pb 2 ปีที่แล้ว

      Hi are u also learning machine learning...??

    • @mahdihabibi1875
      @mahdihabibi1875 5 หลายเดือนก่อน

      I am going to subscribe for this comment since I am starting my master's in Data Science in a week 😂😂 thanks BTW

  • @rweaver6
    @rweaver6 7 ปีที่แล้ว +372

    Wonderful stuff. Sharp, professional and lively. The humorous delivery takes the edge off. At the same time, the presentation is carefully scripted to teach clearly and efficiently. No hesitations, no mistakes, no confusion. Just fast and pleasant learning. The code animation is easy on the eyes and so is she!

    • @alejorabirog1679
      @alejorabirog1679 5 ปีที่แล้ว +7

      It's a master piece.

    • @Sra4825
      @Sra4825 5 ปีที่แล้ว +46

      a masterpiece of a comment. clear and precise points. a subtle hint of hitting on the instructor.

    • @TheMangz1611
      @TheMangz1611 5 ปีที่แล้ว +6

      @@Sra4825 she is worth it!

    • @kizzavincent
      @kizzavincent 3 ปีที่แล้ว +1

      You must be the best communicator of all time! Thanks.

  • @juanmosca
    @juanmosca 6 ปีที่แล้ว +163

    list comprehension is also a good option instead of map function:
    areas_lst = [ area(r) for r in radii ]
    also for filter:
    filtered_lst = [ d for d in data if d > avg ]

    • @xekis
      @xekis 6 ปีที่แล้ว +18

      I was also going to comment that these functions are mostly deprecated because of list comprehension and generator expressions.

    • @normalmighty
      @normalmighty 5 ปีที่แล้ว +18

      I was about to point out the same thing. You can much more cleanly combine both with an expresion like
      filtered_areas_list = [area(r) for r in radii if r > minimum ]
      and for the efficiency of an iterator, just swap the [] with () to make it a generator comprehension
      filtered_areas_iter =(area(r) for r in radii if r > minimum )
      list and generator comprehensions are also far more intuitive for anyone who encounters them in the wild without knowing about them beforehand

    • @obinator9065
      @obinator9065 5 ปีที่แล้ว

      More readable!

    • @balavarikuti
      @balavarikuti 5 ปีที่แล้ว

      And faster than map filter and reduce.

    • @Kachelator
      @Kachelator 5 ปีที่แล้ว

      same here

  • @Socratica
    @Socratica  5 ปีที่แล้ว +5

    We're halfway there. We still need your help! Support Socratica Python Kickstarter: bit.ly/PythonKickstarter

  • @Socratica
    @Socratica  5 ปีที่แล้ว +29

    Welcome to Socratica! You can see our entire Python Playlist here: bit.ly/PythonSocratica
    Subscribe to see all our new videos! bit.ly/SocraticaSubscribe

    • @uprisingstark8954
      @uprisingstark8954 4 ปีที่แล้ว +1

      Pls make more videos on python projects

  • @eppotamus5255
    @eppotamus5255 7 ปีที่แล้ว +12

    I have never seen tutorials this amazing. Its like I traveled back in time 30-40 years when people still made sense - could think and communicate. I enjoyed these so much. Thank you for all the hard work and long hours you guys put into this series. You are hands down the best! Can't wait to see the next one.

  • @rojanshrestha822
    @rojanshrestha822 4 ปีที่แล้ว +33

    if brevity is the soul of wit, then python is in a class by itself !! Wow

  • @ARJUN-op2dh
    @ARJUN-op2dh 6 ปีที่แล้ว +54

    I generally don't comment but I am really amazed by this awesome video is. One word Awesome.... !! loved the way the concept was taught and delivered...

  • @myroncarvalho4872
    @myroncarvalho4872 5 ปีที่แล้ว +19

    Moment I heard the last line. Paused. Liked. Subscribed. Turned on notification. Too good.

  • @Socratica
    @Socratica  5 ปีที่แล้ว

    Support what you love! Socratica has a Kickstarter to make more Python: bit.ly/PythonKickstarter

  • @instant_mint
    @instant_mint 7 ปีที่แล้ว +81

    I can't stop thinking of GLaDOS while listening to this.

  • @hmak5423
    @hmak5423 5 ปีที่แล้ว +2

    At this very moment, you are the most engaging python teacher on TH-cam. Goes down mainly to the tone and style/theme and covering so much in one small video.

  • @stevejohnson1685
    @stevejohnson1685 6 ปีที่แล้ว +6

    From a Haskell programmer: Great introduction! In addition, script provides a nice, subtle sense of humor. Ms. Castro has superb enunciation.

  • @019KADESH
    @019KADESH 4 ปีที่แล้ว +5

    You are in a class by yourself Socratica! The way you teach is simply superb!

  • @AjaySharma-pg9cp
    @AjaySharma-pg9cp 3 ปีที่แล้ว +1

    Till now I haven't seen a video being posted like this, great with differences that making this playlist and channel different from others, keep it up

    • @Socratica
      @Socratica  3 ปีที่แล้ว

      Thank you for your kind and encouraging message!! 💜🦉

  • @doviche
    @doviche 5 ปีที่แล้ว +1

    Just started studying python a month ago, after almost 20 years of java programming language and I've just fallen in love with it.
    Great programming language.
    Very cool and attractive presentations Socratica.

  • @kennymccormic7578
    @kennymccormic7578 6 ปีที่แล้ว +3

    This is by far the most clear explanation of filter/map/reduce! Thank you very much!

  • @pranjal86able
    @pranjal86able 7 ปีที่แล้ว +462

    Loving the hate for Fahrenheit :) "How could this happen"

    • @jcxmej
      @jcxmej 7 ปีที่แล้ว +1

      pranjal86able We do not know. 😂

    • @Psycho4Ever666
      @Psycho4Ever666 7 ปีที่แล้ว +19

      Like my first Professor in electrical engineering, she always told us to keep to keep it clean and metric ^^

    • @aaronmaturanacandelas2370
      @aaronmaturanacandelas2370 7 ปีที่แล้ว

      I was looking for this comment.

    • @divusiulius7539
      @divusiulius7539 6 ปีที่แล้ว +2

      That's why your Elect Engineering teacher likes Peter the Meter Man!

    • @CuongNguyen-le5ic
      @CuongNguyen-le5ic 6 ปีที่แล้ว +8

      Sigh, I wish US would use metric system, make life so much easier.

  • @jakobfredriksson2272
    @jakobfredriksson2272 4 ปีที่แล้ว

    Wow... Yesterday I found this channel and I can honestly write I've had difficulties with map, filter and reduce; especially knowing when to use them. EVERYTHING fell in place with this short video... amazing.

    • @Socratica
      @Socratica  4 ปีที่แล้ว +1

      This was so great to hear - thank you for telling us! It really helps us get motivated to make more videos! 💜🦉

    • @jakobfredriksson2272
      @jakobfredriksson2272 4 ปีที่แล้ว

      @@Socratica You are so welcome! I've watched some more videos this evening and you're making all subjects crystal clear in a very unique way. Keep up the good work! :)

  • @jeffm6651
    @jeffm6651 6 ปีที่แล้ว +2

    This is by far the best explanation of map, filter & reduce in Python ever.

  • @whatyearisit9756
    @whatyearisit9756 5 ปีที่แล้ว +17

    Why is Socratica so underrated. Why, oh why!?

  • @robinccc
    @robinccc 4 ปีที่แล้ว +1

    Didnt ever know that tutorials could be made this engaging. Brilliant.

  • @АндрійКоваленко-и2й
    @АндрійКоваленко-и2й 2 ปีที่แล้ว

    What a beauty... Programming languages always surprise me with its deep. Thank you for clear explanation!

  • @ahmedscrazymixacm1167
    @ahmedscrazymixacm1167 3 ปีที่แล้ว +4

    You are great finally, someone teaches python with enthusiasm, instead of the sleepy attitude , BTW i really like the themes you use Great job

  • @emahbright8607
    @emahbright8607 5 ปีที่แล้ว +8

    this is the funniest python tutorial i've heard in a while....

  • @pdubocho
    @pdubocho 6 ปีที่แล้ว +6

    "How could this happen? I do not know"
    Easily my favorite video.

  • @cruepprich
    @cruepprich 6 ปีที่แล้ว +2

    Best map,filter,reduce explanation i've seen for any language! Thx!

  • @user-wc1sm8cj8s
    @user-wc1sm8cj8s 3 ปีที่แล้ว

    This is the only tutorial I've seen so far with this quality of editing, like, WHOAH!!!!

  • @guilhermehx7159
    @guilhermehx7159 5 ปีที่แล้ว +2

    These Python tutorials of Socratica are simply the best!!! 👏🏻👏🏻👏🏻

  • @faisalee
    @faisalee ปีที่แล้ว

    I am addicted to your channel. Such wonderful delivery and the humour is priceless 😊

  • @tmd4951
    @tmd4951 3 ปีที่แล้ว

    Thanks!

    • @Socratica
      @Socratica  3 ปีที่แล้ว

      Such a kind gesture - thank you so much!! We really do appreciate your support. 💜🦉

  • @indrajitbagchi7313
    @indrajitbagchi7313 7 ปีที่แล้ว

    these are seriously underrated videos......one of the best python tutorials......very nice

  • @MK-lh3xd
    @MK-lh3xd 2 ปีที่แล้ว

    Socratica team is a unique blend of technology, teaching, wit and dialog delivery.

    • @Socratica
      @Socratica  2 ปีที่แล้ว

      These are a few of our favourite things!! 💜🦉

  • @daslolo
    @daslolo 5 ปีที่แล้ว +7

    "Python should be a comedian because it's full of one liners" - subscribed

  • @nikhilkash92
    @nikhilkash92 3 ปีที่แล้ว

    Your presentation is just out of this world.

  • @jasonavina8135
    @jasonavina8135 2 ปีที่แล้ว

    These videos are evidence that anything can be explained in a clear, concise and easy to understand way. It really shows how silly knowledge gatekeeping is at the university and institutional level.

  • @hashroot391
    @hashroot391 6 ปีที่แล้ว +4

    First video I've ever watched on this channel. Kinda spooky but very engaging.

  • @gerardgauthier4876
    @gerardgauthier4876 4 ปีที่แล้ว

    Wow! I can't believe you are dis'ing the reduce function. The reduce function is the general form for more specific functional ideas.. A solid understanding of reduce is essential for any modern programmer.

    • @asero82.
      @asero82. 4 ปีที่แล้ว

      > Beautiful is better than ugly [...]
      python -c 'import this'

  • @jeffbarrett3344
    @jeffbarrett3344 5 ปีที่แล้ว

    Extremely well done series. The best way to learn in my opinion. Short, to the point, engaging, code examples and awesome jokes. Using a one-liner one-liner joke... beautiful!

  • @MrAlhanz
    @MrAlhanz ปีที่แล้ว +1

    You deserve much more attention! Those video are clear, interesting and have a great knowledge transfer.

  • @austinp.b6625
    @austinp.b6625 7 ปีที่แล้ว +171

    hahaha this is good tutorial !!! Sounds like CIA briefing :P

  • @humanrightsadvocate
    @humanrightsadvocate ปีที่แล้ว

    It took me 12 years to find this channel. The algorithm never recommended me this channel. I stumbled upon this channel by entering, filter map lazy, in the search bar. Because... I was doing some exercises with map() and filter() and noticed the following code had unexpected results:
    num_list_4 = [2, 3, 6, 8, 9, 12, 15, 17]
    threevens = filter(lambda x : not x%3, num_list_4)
    sqrs = map(lambda x : x*x, threevens)
    print(num_list_4)
    #print(list(threevens))
    print(list(sqrs))
    The commented out line causes the sqrs list to be empty. And that's why I'm here.

  • @jonathanmeyer4842
    @jonathanmeyer4842 6 ปีที่แล้ว +1

    The "multiplier" lambda expression is already defined in Python -> "import operator as op"
    Therefore the reduce call is : "reduce(op.mul, data)"

  • @RobertoMartinez-pz7im
    @RobertoMartinez-pz7im 2 ปีที่แล้ว +1

    Thanks so much for this video!

  • @poyrazaktas6374
    @poyrazaktas6374 3 ปีที่แล้ว

    I've just explored this channel and I loved it!

  • @henryyao4860
    @henryyao4860 4 ปีที่แล้ว

    This is the most entertaining python tutorial I have seen lol, but at the same time, I got what I need. Thank you!

  • @lost-prototype
    @lost-prototype 2 ปีที่แล้ว

    I love the Command and Conquer / Westwood Studios vibe of these videos. I love post apocalyptic learning.

  • @awisecar9540
    @awisecar9540 7 หลายเดือนก่อน

    Love the Halo/Matrix-esque aesthetic of this channel 🖤

  • @rohitchakravarthi94
    @rohitchakravarthi94 2 ปีที่แล้ว

    If brevity is the soul of wit then python is a class by itself.
    "Wow", this channel needs to be praised for its intellectual content.

  • @GEScott71
    @GEScott71 6 ปีที่แล้ว

    Wow I'm loving Python and Socratica more and more with each video - thanks Socratica!

  • @nkoroieric
    @nkoroieric 7 ปีที่แล้ว

    your illustrations always hit the nail on the head.

  • @kdub1242
    @kdub1242 5 ปีที่แล้ว +1

    This stuff is great. Before going for the heavy artillery, it's also useful to first consider list/dict comprehensions, but map,filter,reduce are great tools for the toolbox.

  • @Sjutturaah
    @Sjutturaah 5 ปีที่แล้ว

    Ok. You just got a sub. These are hilarious while at the same time quite informational and compact. Well done.

  • @karannagpal6390
    @karannagpal6390 6 ปีที่แล้ว +4

    Just so people know, this is in python 3.
    In python 2.7, map returns a list itself and not a generator so there is no need to do list(map(fn, list_of_ele)) rather map(fn, list_of_ele) returns the final list.

    • @Nozomu564
      @Nozomu564 6 ปีที่แล้ว +1

      [fn(el) for el in list_of_ele]
      There's no reason to ever use map in 2.7

    • @rednafi
      @rednafi 5 ปีที่แล้ว +2

      And people who still use python 2.7 should go back to Jurassic age.

  • @jimparsons6803
    @jimparsons6803 ปีที่แล้ว

    Liked the clip. 'Friend Face.' Instructive as always with useful and practical information and approaches.

  • @raphasage
    @raphasage 2 ปีที่แล้ว

    A keen sence of dread lurking around you... ...must complete the class, for your own survival!
    Love the approach! Inta Sub!

  • @aykutdizdar
    @aykutdizdar 6 ปีที่แล้ว +2

    I very much love the correct plural usage form of radius :)

  • @avinash1904931
    @avinash1904931 5 ปีที่แล้ว

    Awesome. I was learning at Coursera applied data science with python. And had doubts in maps and lambda. Came across your video. Very creative and also very nice explanation with real life example. Excellent. Please make more playlists. Thank you so much

  • @a7madx7
    @a7madx7 4 ปีที่แล้ว

    I kinda like your approach very much, must've been so much effort put in this.

  • @stanislavhrytsyshyn1732
    @stanislavhrytsyshyn1732 6 ปีที่แล้ว +3

    Watching ur videos brings a lot of pleasure and understanding of some moments, thx for ur work!

  • @PerpetuaICreativity
    @PerpetuaICreativity 4 ปีที่แล้ว

    This is a python masterclass...even the jokes are efficient. great job and more please!

  • @leaoaugusto
    @leaoaugusto 3 ปีที่แล้ว

    "Python should be a comedian because it is full of one-liners." haha You got me there.!!

  • @samuelfrank9947
    @samuelfrank9947 4 ปีที่แล้ว

    Nice innovative idea than other tutorials to explain.... Loved it

  • @ivandrofly
    @ivandrofly 5 ปีที่แล้ว

    3:09 - "Do not forgot your jacket if you are visiting Argentina" ahaha that was gold!

  • @TheWyrdSmythe
    @TheWyrdSmythe 3 ปีที่แล้ว

    Python ain’t the only comedian on this channel! 😉 I do love map and filter, but after they took reduce away I found myself leaning more towards just using list comprehensions. I usually want a list anyway. I do agree with the philosophy of providing a single way to do something, and map and filter are extra viewed that way.

  • @sparksays7247
    @sparksays7247 2 ปีที่แล้ว +1

    Great (and funny) vid👍🏾

  • @ishanktyagi3220
    @ishanktyagi3220 4 ปีที่แล้ว

    Thats amazing fully qualitative stuff with both professional and some humor thanks for the content

  • @DevinderKumar
    @DevinderKumar 3 ปีที่แล้ว

    Very crisp, clear and efficient !

  • @sandeepnalvaya7612
    @sandeepnalvaya7612 4 ปีที่แล้ว

    After watching this, I want to buy a projector first, and tune in on this channel from video 1. Great work👍

  • @eduard289
    @eduard289 2 ปีที่แล้ว +1

    Very good EXPLANATION

  • @ai.simplified..
    @ai.simplified.. 3 ปีที่แล้ว

    List is a python constructor
    List,earlier list.Append(list1 or lamba to earlier list)
    Map to reduced list

  • @austinp.b6625
    @austinp.b6625 7 ปีที่แล้ว

    So reduce take two inputs at a time .. like the fibinocci and map just one input. Good one. Thanks a lot

  • @diy-projects
    @diy-projects 6 ปีที่แล้ว

    personally I absolutely hate the whole 'outer space' theme BuT there is the best available information available on this channel which makes it one of the best out there so thank you. much appreciated!

  • @MyLinuxToyBox
    @MyLinuxToyBox 5 ปีที่แล้ว +2

    I love the voice and speaking rhythm. Very informative videos.

  • @Leonardo-jv1ls
    @Leonardo-jv1ls 5 ปีที่แล้ว

    I loved the explanation. Thank you. But if is was there in person watching, i would NEVER, raise my hand if had some doubt. This woman talking give me chills.

  • @ghfudrs93uuu
    @ghfudrs93uuu 3 ปีที่แล้ว +1

    I feel like I'm watching a missing debrief from a cartoon about spies from the 90s

  • @mohammadsharif9192
    @mohammadsharif9192 5 ปีที่แล้ว +11

    "we live to serve the user"
    in all my life I've never felt like the disposable tool I'm feeling right now .-.

  • @Jenko022
    @Jenko022 7 ปีที่แล้ว +3

    I have been practising Python three for a while now but what I would really like to see is some videos on project ideas or scenarios to build on using Python. This would be great from practice and learning.

  • @quazichimp
    @quazichimp 7 ปีที่แล้ว +4

    wonderfully presented as always!

  • @mixbaal0
    @mixbaal0 4 ปีที่แล้ว

    Excelent video! I like the style and the presentation character too. And a tasty last line python joke. Congratulations. It would had been gorgeous to have a teacher like her in my college years. Hahahaha!!!

  • @bicycleninja1685
    @bicycleninja1685 5 ปีที่แล้ว

    Awesome. The reduce example also works with text. ",".join(mylist) is commonly used, but reduce gives you more flexibility and in my opinion is more elegant, especially if you're combining multiple operations/functions.

  • @greyhnd001
    @greyhnd001 5 ปีที่แล้ว

    Awesome scripts. I am seeing this usefull for converting ips to binary and build a subnet calculator to confirm our firewall configurations are correct. Thank you so much for the work you've done on this.

  • @akira_asahi
    @akira_asahi 2 ปีที่แล้ว

    Thank you for the video. I am grateful for your time and contribution. Kind regards, Akira.

  • @GamingBlake2002
    @GamingBlake2002 5 ปีที่แล้ว +1

    Great tutorial, concise and simple

  • @hooshtube
    @hooshtube 7 ปีที่แล้ว +4

    Please do a video on xml in python as well. These videos are priceless.

    • @skilz8098
      @skilz8098 5 ปีที่แล้ว

      She compared xml to json in a previous video and basically said to hell with xml... for it's complexity....

  • @jakeambrose4294
    @jakeambrose4294 2 ปีที่แล้ว

    Your course is awesome! Thank you. Im going through sololearns python courses and for each section, whatever the subject is, i come to your vids for further thorough explanation of whats being taught. I Appreciate your efforts more than words can express.

  • @bulentkamali
    @bulentkamali 6 ปีที่แล้ว

    Very charming and delightful narrative

  • @PKR1503
    @PKR1503 4 ปีที่แล้ว

    Your explanations are the best! Thanks for the help.

  • @davidgraham9525
    @davidgraham9525 5 ปีที่แล้ว +1

    Socratica, you are missing a golden opportunity by not having merchandise from this series.

  • @Tweston3ny
    @Tweston3ny 2 ปีที่แล้ว

    Fantastic, per usual. Thank you. Awesome presentations with flawless, logical, and efficient, instruction and code.

  • @natalieastafeva4885
    @natalieastafeva4885 4 ปีที่แล้ว

    You made python sound like a detective story,very entertaining and useful!

  • @nicolasribard1519
    @nicolasribard1519 4 ปีที่แล้ว

    The course is very simple... But the art direction is sooooo cool

  • @pruthvip8137
    @pruthvip8137 3 ปีที่แล้ว

    A unique style of python concept explanation , very different from other python learning TH-cam videos . Nice :)

  • @Schlumpfpirat
    @Schlumpfpirat 5 ปีที่แล้ว

    Interesting approach style-wise. I like it.

  • @indianameregone
    @indianameregone 4 ปีที่แล้ว +1

    First time I watch your video I think u r awesome

  • @aghoorchian
    @aghoorchian 3 ปีที่แล้ว

    Captivating while teaching me what I needed to learn. Finally I know I'm gonna master Python soon!

  • @godwinmech
    @godwinmech 4 ปีที่แล้ว

    Wow... finally understood... thanks and subscribed