I am trying to build a function that uses .shift() but it is giving me an error. Consider this:
In [40]:
data={\'level1\':[20,19,20,21,25,29,30,31,30,29,31]
Check if the values you are trying to shift is not an array. Then you need to convert the array to series. With this you will be able to shift the values. I was having same issues,now I am able to get the shift values.
This is my part of the code for your reference.
X = grouped['Confirmed_day'].values
X_series=pd.Series(X)
X_lag1 = X_series.shift(1)