I'm pretty new to Python and I just encountered a problem.
mini_agg
is my original pandas.dataframe
and I'm trying to group
it by 2 columns.
trial = mini_agg.groupby(['date','product','product_type_1','product_type_2','product_type_3','product_type_4']).sum()
print mini_agg.shape
print trial.shape
output:
(2965909, 10)
(499281, 4)
Furthermore I cannot access the keys by which I grouped by. In R I do obtain my column back when using aggregate.
Can you please help me? Thank you in advance