I have the following dataframe:
dates,rr,ax,be
2018-01-01 00:00:00,45.73,47.63,45.83
2018-01-01 01:00:00,44.16,44.42,44.59
2018-01-01 02:00:00,42.24,42.34,40.22
2018-01-01 03:00:00,39.29,38.36,37.31
2018-01-01 04:00:00,36.0,36.87,32.88
2018-01-01 05:00:00,41.99,39.79,39.27
2018-01-01 06:00:00,42.25,42.08,43.62
2018-01-01 07:00:00,44.97,51.19,49.69
2018-01-01 08:00:00,45.0,59.69,49.98
2018-01-01 09:00:00,44.94,56.67,48.04
2018-01-01 10:00:00,45.04,53.54,46.85
2018-01-01 11:00:00,46.67,52.6,47.95
2018-01-01 12:00:00,46.99,50.77,46.6
2018-01-01 13:00:00,44.16,50.27,43.02
2018-01-01 14:00:00,45.26,50.64,44.2
2018-01-01 15:00:00,47.84,54.79,47.1
2018-01-01 16:00:00,50.1,60.17,50.83
2018-01-01 17:00:00,54.3,59.47,58.31
2018-01-01 18:00:00,51.91,60.16,63.5
2018-01-01 19:00:00,51.38,70.81,61.9
2018-01-01 20:00:00,49.2,62.65,59.62
2018-01-01 21:00:00,45.73,59.71,52.84
2018-01-01 22:00:00,44.84,50.96,51.43
2018-01-01 23:00:00,38.11,46.52,45.35
2018-01-02 00:00:00,19.19,49.62,41.61
2018-01-02 01:00:00,14.99,45.05,40.78
2018-01-02 02:00:00,11.0,45.18,39.59
then I group according to the hour in the index as follows:
df1 = df.assign(hour=lambda x: x.index.hour).groupby('hour')
at this point, I would like to compute the mean of each group. I do as follow:
aa = df1['hour'].mean()
This seems to not working. What am I missing?
Thanks,
Diego