Reputation: 197
I have a Dataframe series with 30s
frequency.
df.head()
I want to calculate the daily averages for all signals in that series but it doesnt seem to work. I tried both
df_average = df.to_period('D')
df.resample('D')
I want to have only 1 line per day. Why do i get more? Thank you
Upvotes: 1
Views: 106
Reputation: 26676
@jezrael is sure way to go. Could also try;
df.groupby(df.index.date).mean()
Upvotes: 0
Reputation: 862641
If there is DatetimeIndex only add an aggregate function, here mean
, to resample
:
df1 = df.resample('D').mean()
Upvotes: 3