Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
111 views
in Technique[技术] by (71.8m points)

python - Error when using 'rolling_sum' on pandas. How to apply 'rolling_sum' correctly to pandas?

temp = []
fields = ['error%d' % i for i in range(1,6)]
for col in fields:
    temp.append(pd.rolling_sum(pd.pivot_table(error_count,
                                               index='datetime',
                                               columns='machineID',
                                               values=col), window=24).resample('3H',
                                                                             closed='left',
                                                                             label='right',
                                                                             how='first').unstack())
error_count = pd.concat(temp, axis=1)
error_count.columns = [i + 'count' for i in fields]
error_count.reset_index(inplace=True)
error_count = error_count.dropna()
error_count.describe()

How can I calculate the total number of errors of each type in the last 24 hours, for time points taken every three hours? Github has that code, but it is giving this error:

C:Program FilesMicrosoftML ServerPYTHON_SERVERlibsite-packagesipykernel_launcher.py:7: FutureWarning: pd.rolling_sum is deprecated for DataFrame and will be removed in a future version, replace with DataFrame.rolling(window=24,center=False).sum()

import sys

C:Program FilesMicrosoftML ServerPYTHON_SERVERlibsite-packagesipykernel_launcher.py:10: FutureWarning: how in .resample() is deprecated the new syntax is .resample(...).first() # Remove the CWD from sys.path while we load stuff.

And I not know how to apply that resolucion.

Link to github: https://github.com/ashishpatel26/Predictive_Maintenance_using_Machine-Learning_Microsoft_Casestudy

enter image description here

I using is version python 3.8

question from:https://stackoverflow.com/questions/65866008/error-when-using-rolling-sum-on-pandas-how-to-apply-rolling-sum-correctly-t

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...