I have hourly data, of variable x
for 3 types, and Category
column, and ds
is set as index.
> df
ds Category X
2010-01-01 01:00:00 A 32
2010-01-01 01:00:00 B 13
2010-01-01 01:00:00 C 09
2010-01-01 02:00:00 A 12
2010-01-01 02:00:00 B 62
2010-01-01 02:00:00 C 12
I want to resample it to Week
. But if I use df2 = df.resample('W').mean()
, it simply drops 'Category' Column.