Group By and Aggregate Functions in Pandas | Python Pandas Tutorials

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

КОМЕНТАРІ • 113

  • @pstefanics
    @pstefanics Рік тому +300

    3:27 note that to avoid a FutureWarning (and an error later), you need to specify df.groupby('Base Flavor').mean(numeric_only = True)

    • @srijanrawat4014
      @srijanrawat4014 Рік тому +2

      thanks man that helped me a lot

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

      Thank you very much man, so useful

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

      super useful ...thank you

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

      Gracias amigo , me salvastes el día . Tenias horas con este problema . que no me ocurría en la versión 1.2.1 de Pandas . pero al subir a la versión 2.1.1. me daba error . por no incluir "numeric_only = True"

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

      It was very helpful, Thank You

  • @Kwuasimoto
    @Kwuasimoto Рік тому +26

    The "I've spent years researching this" at the start killed me 😂

  • @pancakez2181
    @pancakez2181 Рік тому +7

    “Squiggly bracket” > “curly bracket” 😂
    Also the first time I’ve seen describe() with groupby(). Makes total sense, thank you!

  • @GhulamHussainKhuhro
    @GhulamHussainKhuhro 3 місяці тому +1

    Dear Alex,
    I'm writing to express my sincere gratitude for your video tutorial on groupby in Jupyter Notebook. It was very helpful in understanding the basics of calculating means for grouped data.
    However, I noticed that the tutorial didn't explicitly address how group_by.mean() handles non-numeric data. In the current version of pandas, attempting to calculate the mean of a column with non-numeric values will raise a TypeError.
    I found solution that by passing numeric_only = True in mean () the issue is resolved.
    I would be grateful if you could consider updating the video to include a note to pass numeric_only = True in mean()
    Thank you again for your excellent tutorials ❤❤

  • @toygar8699
    @toygar8699 10 місяців тому +32

    For those who get error in mean,
    df.groupby('Base Flavor').mean(['Flavor Rating','Texture Rating','Total Rating'])

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

      Thanks man !!

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

      Thank you for your msg, it helped me, but i wanted to know , how come in the video alex got the output with out inputting any column names in mean(), can you help

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

      @@navyajuvvaladinne5045 yw, I don't know, maybe old version

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

      Bro I was trying to solve this for days,I completed pandas,numpy completly but can't do groupby and then I saw your comment❤
      Jizaq Allah❤
      Thanks❤

    • @toygar8699
      @toygar8699 8 місяців тому +1

      I'm so glad I helped ❤

  • @mgsports9561
    @mgsports9561 8 місяців тому +1

    One question if I get this "AttributeError: 'DataFrame' object has no attribute 'gruopby" how can fix it?

  • @skugga7
    @skugga7 6 місяців тому +1

    Where did you collect this data from? It looks incredibly thorough and well-organized for its size

  • @KUKRETI07
    @KUKRETI07 6 місяців тому +2

    very few channel has this comment "greak"

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

    What did Boris do, to be the pandas course of choice on Udemy to receive paid promotion?

  • @LeonardDim
    @LeonardDim 2 місяці тому +1

    love this thank you, 2 years ago and still commenting

  • @ahmadch9275
    @ahmadch9275 Рік тому +2

    Hey Alex, Hope you are doing well. First to let you know that you have been a great help for me in navigating the data analytics domain.
    You once mentioned in one of your videos that cloud computing is now a necessary skills for Data analysts and that you would explain this in detail in one of your video. we are eagerly waiting for this video. Please make one when feasible.

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

      I do have those videos coming up on AWS and Azure!

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

      @@AlexTheAnalyst thanks buddy, and please know that we all appreciate the kind work that you are doing. God bless you

  • @wkorn89
    @wkorn89 7 днів тому

    Thanks Alex, you saved me with this video

  • @Merrickul
    @Merrickul 7 місяців тому +1

    Thanks Alex this was a great video. Short, concise and to the point !

  • @rabiahchaudhry9774
    @rabiahchaudhry9774 10 місяців тому +1

    Hey alex... thanks for the wonderful work... i have been following along your tutorials and practicing them but for some reason my mean agg function is not working... the rest of them are working just fine... what could be the reason behind that...

    • @AnatolyKosharovsky
      @AnatolyKosharovsky 8 місяців тому

      Try use: group_by_frame = df.groupby('Base Flavor')[['Flavor Rating', 'Texture Rating', 'Total Rating']].mean() - It's recommended to specify the columns for which you want to apply the mean() function. Works for me

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

    is data analyst oversaturated? someone said that, wdyt alex?

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

    Thank you very much! as always, your videos are very helpful!

  • @sirrobotoftheinternet4078
    @sirrobotoftheinternet4078 6 місяців тому

    I need help anytime I try to move from the mean part of video on my laptop all I get is an error. However everything else works. Like sum, count, max, min. Does anyone have any tips for me please and thank you ?
    At the bottom of my error says “ could not convert chocolaterocky roadchocolate fudge brownie to numeric

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

    I really like this series and many thanks to Alex for sharing such useful knowledge.

  • @DreaSimply21
    @DreaSimply21 11 місяців тому +1

    Why the query would not let me run df.groupby('Base Flavor').mean(), unless I put 'Based Flavor' in the aggregation function? However, it allowed me to run the other aggregations without having to include the column I am looking for in the function.

  • @Niranga.555
    @Niranga.555 Рік тому +1

    Thanks for your great work Alex..!

  • @dimitrijemarinkovic4451
    @dimitrijemarinkovic4451 6 місяців тому

    How can i save grouped dataframe to csv but i also need to save index as column values

  • @Eng_Aldo-tp2hy
    @Eng_Aldo-tp2hy Місяць тому

    Thank a lot for your video, it´s great!!

  • @ssteo4136
    @ssteo4136 10 місяців тому

    dear alex, could you please add sort after group by analysis ?

  • @sj1795
    @sj1795 9 місяців тому

    Great run through of the popular aggregate functions. Really appreciate the little summary definitions you do at the beginning of your videos. Example: "Group by: groups together values in a column and displays them all on the same row", etc. As always, THANK YOU ALEX!! Happy New Year!

  • @eda569
    @eda569 7 місяців тому

    Why did the SUM function give this output?
    output:
    Flavor Liked Flavor Rating Texture Rating Total Rating
    Base Flavor
    Chocolate ChocolateRocky RoadChocolte Fudge Brownie YesYesYes 25.2 21.7 47.1
    Vanilla Mint Chocolate ChipVanillaCookie DoughPistachi... YesNoYesNoYesNo 34.2 33.9 68.1

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

      have you found the solution? same output. just doing it now

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

      df.groupby('Base Flavor').sum(numeric_only = True)

  • @umamiimamu
    @umamiimamu 6 місяців тому

    Thank you, lovely useful content

  • @natnaelberhanu-i8w
    @natnaelberhanu-i8w 2 місяці тому

    you da man

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

    I am interested to become a data analyst where do i begin, dont you have a beginner course? Or community so that we can join? I dont have any information about data analyst so i want to be taught from beginner friendly

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

      Not this lol excel really is the main starting point, then onto SQL look into courses like Google data analyst professional certification

  • @01Ashish01
    @01Ashish01 Рік тому +1

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

    Excellent. Much better than edx ibm course

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

    This was very helpful, thank you!

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

    Thanks a lot Alex! First one🎉🎉

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

    very clear tutorial. nice work!

  • @Lorryduckie2
    @Lorryduckie2 8 місяців тому

    neat content ! thanks

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

    Thanks sir🎉🎉🎉🎉

  • @SACHINKUMAR-px8kq
    @SACHINKUMAR-px8kq Рік тому

    Thanks Sir

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

    Thanks 🤩🤩🤩

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

    why my pandas program in python work like this print(df.groupby(['Base Flavor', 'Liked']).mean(['Base Flavor', 'Liked']))
    and don’t work like this:
    print(df.groupby(['Base Flavor', 'Liked']).mean())