Groupby df by multiple columns while also keeping the rest of the df columns
December 09, 2022
df.groupby(['col1','col2','col3']).agg({'col1': 'first', 'col2': 'first', 'col3': 'firs...})
Instead of first, you can also apply sum, mean, count or any other function.
first
sum
mean
count