Pandas use a list of values to select rows from a column

preview_player
Показать описание
Pandas use a list of values to select rows from a column

Notebook:

Topics

* value counts on the whole dataframe
* case insensitive search for dataframe

* filter pandas rows by partial match from a list

dev_list = ['Mobile', 'Data', 'QA']

import re
for dev in dev_list))

* filter pandas rows by exact match from a list

df[df['UndergradMajor'].isin(['Mathematics or statistics',
'Web development or web design'])].head()

Bonus

execute value counts on multiple columns

Vectorization is the process of executing operations on entire arrays.

---------------------------------------------------------------------------------------------------------------------------------------------------------------
Bonus resources

March 2019 Machine Learning Study Path

---------------------------------------------------------------------------------------------------------------------------------------------------------------
Code store

Socials

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

Great tutorial. One question regarding value_counts in line 14..

dev_df[['Mobile', 'QA']].apply(pd.Series.value_counts)

... could you show how to output those values in form of percentages pls. Thanks.

markfischle