Python pandas—Filtering & Sorting Exercise—Euro 12

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:

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

Great, The things i learned the things in just 15-20 minutes that could have taken over 4 hrs to learn from elsewhere.

vivekgarg
Автор

Took 35 mins to get it all done, mostly on Step 14!
Things that I learned from this lecture:
ls
len(df.columns)
df.sort_values(by = ['aa', 'bb'])
df['aa'].str.startswith('G')
df.iloc[:, :7].shape
☆ set_index => df.loc[list, column name]

arhataria
Автор

Thanks for this exercise.it really helps a lot for a beginner like me. From the beginner point of view;
Question 5: lets assume that somehow, teams are written more than once on "Team" column, so my answer would be ;
euro12.Team.nunique()

question 6 : as you said some alternative ways are ;
euro12.shape[1] ( this is for columns, [0] is for the rows )
len(euro12.columns)

question 14 : totally beginner approach would be
(euro12.Team=="Italy")| (euro12.Team=="Russia")
euro12[filt].loc[:, ["Shooting Accuracy"]]

murat
Автор

Great video, thank you! My biggest takeaways were: using ls (mind blown), .startswith(), and using set_index to make .loc easier/more readable. Now I am going to try to find the keyboard shortcuts you are using.

woodyburns
Автор

Thank for showing this pandas exercise. I am wondering what short cut do you used to add " " on the "Team", Red Card, Yellow card on 3:58

tonghu