Dec-09-2017, 08:38 PM
from numpy import * import numpy as np import pandas as pd data = [1.0, 2.0, 3.0, 4.0] s1 = pd.Series(data) rollmean = pd.Series.rolling(s1, 2).mean() #print(rollmean) filled0 = [0.0 if isnan(item) else item for item in rollmean] print(filled0)Great, I have figured it out with the above code.
Thanks,