Pandas use a list of values to select rows from a column
https://blog.softhints.com/pandas-use...
Notebook:
https://github.com/softhints/python/b...
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
dev_df = pd.DataFrame(dict((dev, df.DevType.str.contains(dev, re.IGNORECASE))
for dev in dev_list))
dev_df.head(20)
* 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
dev_df.apply(pd.Series.value_counts)
dev_df[['Mobile','QA']].apply(pd.Series.value_counts)
Vectorization is the process of executing operations on entire arrays.
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Bonus resources
March 2019 Machine Learning Study Path
https://github.com/clone95/Machine-Le...
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Code store
github: https://github.com/softhints/python/
bitbucket: https://bitbucket.org/softhints/
Socials
site: https://softhints.com/
Facebook: / 435421910242028
Facebook: / softhints
Twitter: / softwarehints
Discord: / discord