Lambda in Python - Advanced Python 08 - Programming Tutorial - Map Filter Reduce

Поділитися
Вставка
  • Опубліковано 24 сер 2024

КОМЕНТАРІ • 61

  • @TelepathShield
    @TelepathShield Місяць тому +1

    I researched about lambda functions but was still confused on how it was being used in the sort and sorted functions.
    You covered it thankfully in this video, and it helped a lot, thanks!

    • @TelepathShield
      @TelepathShield Місяць тому +1

      I had thought that the key parameter was a value not a function. But again, it was a huge help and very easy to understand

  • @nemesis_rc
    @nemesis_rc 3 роки тому +8

    Probably the best python tutorial in YT.

    • @patloeber
      @patloeber  3 роки тому +1

      thanks a lot!

    • @xzex2609
      @xzex2609 Рік тому

      don't take me wrong this channel is great and I learn a lot from him , but the best ( hands down ) goes to Bro Code 12 hour python tutorial , it's unbelievable And I just want to share with everyone

  • @Jacques_3d
    @Jacques_3d 4 місяці тому

    Best advanced python tutorial

  • @cetilly
    @cetilly 2 роки тому +7

    Really well presented; you conveyed the concepts extremely well.

    • @patloeber
      @patloeber  2 роки тому +1

      glad to hear this :)

  • @bigspicydad8970
    @bigspicydad8970 Рік тому +1

    Thanks for the vid Patrick! This really helped me

  • @user-bo1uw6vy3l
    @user-bo1uw6vy3l 3 місяці тому

    This is the best python tutorial i think. Thanks for giving free advance tutorial.

  • @rob876
    @rob876 4 роки тому +1

    Not quite an advanced course but extremely thorough and brilliantly presented. I've saved it so I can keep it as a reference.

    • @patloeber
      @patloeber  4 роки тому +3

      Thank you very much! I know it’s more between beginner and advanced, but I’m glad you like it :)

  • @geetak5285
    @geetak5285 Рік тому

    Thank you for making things simple to understand

  • @BbB-vr9uh
    @BbB-vr9uh 2 роки тому

    Thank you! I needed a video on how to use these, as the docs didn’t make a whole lot of sense on my first read through. This has helped out a lot!

  • @pkavenger9990
    @pkavenger9990 3 роки тому +1

    I found this Video the best, how is this Video dont have more likes and Views.

  • @kvelez
    @kvelez 9 місяців тому +1

    from functools import reduce
    add_num = lambda x: x+10 #anonymous
    print(add_num(5))
    mul_num = lambda x,y: x*y
    print(mul_num(5,4))
    points2D = [(1,2), (15,1), (5,-1), (10,4)]
    sort_points = sorted(points2D) #sort by x argument
    print(sort_points)
    sort_points = sorted(points2D, key=lambda x: x[1]) #lambda sort with y
    print(sort_points)
    sort_points = sorted(points2D, key=lambda x: x[0]+x[1]) #lambda sort sum
    print(sort_points)
    a = [1,2,3,4]
    b = list(map(lambda x: x*2, a)) #map iterable and lambda func + arr
    print(b)
    print([x*2 for x in a]) #list comprehension abbreviation
    c = list(filter(lambda x: x % 2 == 0, a)) #filter -> bool + lambda + arr
    print(c)
    print([x for x in a if x % 2 == 0]) #list comprehension
    d = reduce(lambda x,y: x*y, a) #product of list
    print(d)

  • @sohailaali2081
    @sohailaali2081 2 роки тому

    THANK YOUUUUUUU IT WEAS SO CLEAR AND VERY HELPFUL!!

  • @sharanpai4996
    @sharanpai4996 Рік тому

    Thanks for making life easier!

  • @castlecodersltd
    @castlecodersltd Рік тому

    Nice, thanks

  • @jackieli1724
    @jackieli1724 11 місяців тому

    Nice and neat

  • @raseshshetty2386
    @raseshshetty2386 4 роки тому +1

    Hey Pal you deserve more than a million subs... dude u helped me a lot in the * operator video

    • @patloeber
      @patloeber  4 роки тому

      Thanks for the feedback :)

  • @revolution77N
    @revolution77N 2 роки тому +2

    I would loved it more if you've covered the if and else inside lambda. But thank you for your efforts!

    • @CrazyFanaticMan
      @CrazyFanaticMan 2 роки тому +2

      I remember when I wanted to put an if in a lambda function and it wasnt working and i was losing hair. Then i realized that the else is *required* otherwise itll throw an error, unlike in a list comprehension where an else is not required
      I still mostly only stick to using list comprehensions although I do love the way the code aesthetically looks in a lambda function haha

    • @gabrielafotey5069
      @gabrielafotey5069 Рік тому

      @@CrazyFanaticMan you can put an else in a list comprehension

    • @CrazyFanaticMan
      @CrazyFanaticMan Рік тому

      @@gabrielafotey5069 Yes you can but it isn't necessary
      In a lambda function, an else is necessary if you want to use an if statement

    • @gabrielafotey5069
      @gabrielafotey5069 Рік тому

      @@CrazyFanaticMan I get you now. I thought you said else isn’t allowed in list comprehensions. My bad

  • @expat2010
    @expat2010 3 роки тому +2

    Thanks but i wish you addressed using lamda on a dataframe with apply and map. Getting the syntax right can be frustrating for newbies.

    • @patloeber
      @patloeber  3 роки тому +2

      Thanks for the feedback! Will consider this next time

  • @StefanoVerugi
    @StefanoVerugi Рік тому

    useful and clear tutorial, thanks

  • @gdthegreat
    @gdthegreat Рік тому

    Nice video bro.

  • @jashielp.estrada7163
    @jashielp.estrada7163 2 роки тому

    Thanks for the explanation.

  • @xzex2609
    @xzex2609 Рік тому

    according to pep 8 we should not assign the lambda functions and use them as call backs , and when we want to name it use just def mul(x,y):return x*y is one liner and is fine , he only use case I saw somewhere was to assign it in a call back via walrus operator that was some application inside the function too

  • @frankrobert9199
    @frankrobert9199 Рік тому

    great

  • @reshmakodwani4732
    @reshmakodwani4732 3 роки тому

    Thank you it was helpful 👍

    • @patloeber
      @patloeber  3 роки тому +1

      thanks! glad it's helpful

  • @kratostheinevitable3932
    @kratostheinevitable3932 2 роки тому

    thanks

  • @user-wb5vo7xk9k
    @user-wb5vo7xk9k Рік тому

    It is possible to use Lambda with strings?

  • @mittshah9598
    @mittshah9598 3 роки тому

    great work!

  • @arunthiyaagarajan3357
    @arunthiyaagarajan3357 2 роки тому

    Thank you! Its so understandable!

  • @srh1034
    @srh1034 12 днів тому

    Good content but lack clarity of what you want to achieve with each method. Especially when starting writing example it is not clear what you want to achieve which minimizes the value of content

  • @killarfridge
    @killarfridge 2 роки тому

    would love to see more on the groupby function in the future. Other than that great video as always :)

  • @ventin75
    @ventin75 Рік тому

    lambda or list comprehension ftw?

  • @belgacem_mehdi
    @belgacem_mehdi 2 роки тому

    The X We call it parameter or argument !

  • @ilyamofidian2435
    @ilyamofidian2435 4 роки тому

    Thanks for all your helpful videos. That would be great if you share the configuration of your VS code. It looks as simple as sublime, and you don't necessarily run your codes in terminal.

    • @patloeber
      @patloeber  4 роки тому

      Hi, I use pretty much the standard configuration. The only extensions I have installed are: Python, Code Runner, and pylint

    • @satyamjha1779
      @satyamjha1779 2 роки тому

      yes you can change the setting of code runner extension.
      and can run your code in output.

  • @user-or7ji5hv8y
    @user-or7ji5hv8y 3 роки тому

    Hard to see a situation why reduce() is useful. Any suggestion?

  • @kishorbanu3724
    @kishorbanu3724 2 роки тому

    Hey could you please maximise screen

  • @gzbin365
    @gzbin365 2 роки тому

    cool!

  • @maddison....
    @maddison.... 2 роки тому +1

    Is this pycharm ?
    Or something, plz say so I can also download

    • @retvolki
      @retvolki Рік тому +1

      I'm 99% sure this IDE he's using is VS Code for Mac, not PyCharm...

  • @summerxia7474
    @summerxia7474 2 роки тому

    Can I know what editor you are using? Thanks~

    • @killarfridge
      @killarfridge 2 роки тому +1

      pretty sure it's Visual Studio Code

  • @rudra.one9
    @rudra.one9 Рік тому

  • @alexwu7111
    @alexwu7111 3 роки тому

    i'm gonna sleep....dude

  • @drnotebook
    @drnotebook 3 роки тому

    Change the name for this video series. This is beginner stuff. Don't
    lie to people by calling it advanced. You lose your credibility from
    the start when you LIE to people right from the start.

  • @handsome_man69
    @handsome_man69 Рік тому

    Boring