0
$\begingroup$

I have time series data of electricity consumption. I want to calculate rolling standard deviation of 1 hour intervals with window size of 10 i.e. I want to take values from 8-9AM for last 10 days and compute std() for that window, then compute it for 9-10 AM window across last 10 days and so on.

I tried below 2 approaches but these are not working:

df.groupby(df.index.time)['value'].rolling(10).std()
df.groupby([df.index.date, pd.Grouper(freq='1h')])['value'].std()
$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.