Query and Filter Functions (Pandas Tutorials 07)

preview_player
Показать описание
Join this channel to get access to perks:

If you enjoy this video, please subscribe.

If there's a specific video you would like to see or a tutorial series, let me know in the comments and I will try and make it.

You can follow me at:
Рекомендации по теме
Комментарии
Автор

Nice video, for sure. It is important that the column names do not have spaces.
The dataset used already had good column names that did not have spaces but I use this code:
df.columns=[x.replace(" ", "_") for x in df.columns] # removes spaces from column names for Pandas query()

mikedata
Автор

Thanks. You can just write and/or instead of the ampersand. Etc.

Frdy
Автор

How can I use the query function to create a new column? Here is what I have tried:

df['adult_child'] = df.query('sex =="male" & age <=15') = "male_child"

CaribouDataScience
Автор

really helpful! thanks for making this video

tanimsk