Python pandas—Grouping Exercise—Alcohol Consumption

preview_player
Показать описание
Sometimes we learn best by doing. Unlike my other videos, I’ll be going through these exercises cold. Sometimes we’ll encounter ambiguous questions, and sometimes I'll be wrong. Learning from our mistakes can be a powerful teacher. So, it’s OK to be wrong now, because we’ll know how to avoid it next time when it counts. My hope is that you will learn by doing. Why don’t you proceed through the linked exercises before we walk through them together? This series can be viewed in tandem with my “An Opinionated Guide to pandas“ video series (links below), but it’s not required. This series is beginner-friendly but aimed most directly at intermediate users.

This Learning by Doing is part of the pandas indexing and selecting:

Рекомендации по теме
Комментарии
Автор

In case people wonder why there is North America, that's because its continent code is 'NA' and that was regarded as null by pd.read_csv. A good example to be careful with parsing your data!

To prevent this, we can pass keep_default_na=False to pd.read_csv

marcowong
Автор

Love yr teaching style, I feel fun & motivated to practice along unlike w other grim tutors.

tomparatube
Автор

Took 30mins to get it all done!
Functions I learned from this lecture:
df.groupby('a')['b'].mean()

df.groupby('a')['b'].median()
df.groupby('a')['b'].agg(['min', 'max', 'mean'])

arhataria
Автор

Thanks for all the lovely exercises videos. kind of gem here !
Concerning question 8, it can be ;
drinks.groupby("continent").spirit_servings.describe()[["mean", "max", "min"]]

murat
Автор

did anyone get step 5 the exact way in the series like in the exercise?

Random_Legends_Shorts
Автор

Thanks for that, I had never used or seen anyone else use the 'agg' method before. I prefer returning a df

MrJakd
Автор

Step 4 Which continent drinks more beer on average? doesn't this mean that we need to find average beer consumption continent wise and then compare with each continent consumption to find out which one consumes more than the average. Please correct me if I am wrong.

amitsingh