Pandas Flashcards
1
Q
pd.concat()
A
(df1,df2,axis=0)
2
Q
df.sort_values()
A
( [ ] ,ascending= , inplace=)
3
Q
df.fillna()
A
( ‘ ‘ , inplace= )
4
Q
df.drop()
A
( [ ] ,axis=1)
5
Q
df.rename()
A
( columns={ } , inplace=)
6
Q
df.merge()
A
( df2, left_on=’‘,right_on=’’, how= )
7
Q
df.replace()
A
( { } , inplace= )
8
Q
df.drop_duplicates()
A
([ ], keep= , inplace= )
9
Q
df.dropna()
A
(subset= ,inplace= )
10
Q
df.rank()
A
(ascending= , method=’dense’)
11
Q
pd.DataFrame( )
A
“userid”: [1, 2, 3, 4, 5],
“country_id”: [46, 46, 358, 49, None]
12
Q
fix the index
A
reset_index(drop=True)
13
Q
df.apply()
A
(lambda x : ‘Sweden’ if x[‘name’]==’Christian’ else x[‘country’], axis=1)
or
(function,axis=1)
14
Q
df.groupby()
A
( [ ] )
15
Q
.agg()
A
(user_count=(‘user_count’, ‘count’))