CheatSheet | Pandas

Groupby

agg_functions = {'col1':'first', 
                 'col2' : 'sum', 
                 'col3' : lambda col: ' && '.join(col), }

df_new = df.groupby(df['id']).aggregate(agg_functions)

Filter

df.iloc[[0,1,2,3,4,5]] # get rows by indices # not iloc() => iloc[]

# Filtering rows that contain either sub_str1 or sub_str2
df_new = df.loc[df['Column'].str.contains("sub_str1|sub_str2", case=False)]

Manipulate Row

df.drop(i) # remove i-th row

df.sort_values(by, ascending=True) # sort