Pandas Flashcards
pd.concat()
(df1,df2,axis=0)
df.sort_values()
( [ ] ,ascending= , inplace=)
df.fillna()
( ‘ ‘ , inplace= )
df.drop()
( [ ] ,axis=1)
df.rename()
( columns={ } , inplace=)
df.merge()
( df2, left_on=’‘,right_on=’’, how= )
df.replace()
( { } , inplace= )
df.drop_duplicates()
([ ], keep= , inplace= )
df.dropna()
(subset= ,inplace= )
df.rank()
(ascending= , method=’dense’)
pd.DataFrame( )
“userid”: [1, 2, 3, 4, 5],
“country_id”: [46, 46, 358, 49, None]
fix the index
reset_index(drop=True)
df.apply()
(lambda x : ‘Sweden’ if x[‘name’]==’Christian’ else x[‘country’], axis=1)
or
(function,axis=1)
df.groupby()
( [ ] )
.agg()
(user_count=(‘user_count’, ‘count’))
make df[‘signup_date’] to month
.dt.month
.rolling()
(window=7, min_periods=1).sum()
remove time in datetime
df.normalize()
row_number
df.reset_index(drop=True).index + 1
+ pd.to_timedelta()
(3, unit=’D’)
unique()
tar fram alla columner