0
temp = []
fields = ['volt', 'rotate', 'pressure', 'vibration']
for col in fields:
temp.append(pd.rolling_mean(pd.pivot_table(telemetry,
                                           index='datetime',
                                           columns='machineID',
                                           values=col), window=24).resample('3H',
                                                                            closed='left',
                                                                            label='right',
                                                                            how='first').unstack())
telemetry_mean_24h = pd.concat(temp, axis=1)
telemetry_mean_24h.columns = [i + 'mean_24h' for i in fields]
telemetry_mean_24h.reset_index(inplace=True)
telemetry_mean_24h =    telemetry_mean_24h.loc[-telemetry_mean_24h['voltmean_24h'].isnull()]

rolling mean is not working and give this error. Can you describe the code? and why does not it work?

cs95
  • 379,657
  • 97
  • 704
  • 746
özlem bulu
  • 31
  • 2
  • 5

1 Answers1

0

I cannot find pd.rolling_mean() function in any recent pandas versions.

It seems to have been replaced by: pd.core.window.Rolling.mean?

Make sure to use up-to-date documentation for your version of pandas.

https://pandas.pydata.org/pandas-docs/stable/generated/pandas.core.window.Rolling.mean.html

Alexis Drakopoulos
  • 1,115
  • 7
  • 22