I am trying to get the rolling(N) value to get the max from other column. e.g.
Value RollV Maxrol Requiredoutput
0 541.95 1 0 0
1 541.9 2 0 541.95
2 541.5 3 0 541.95
3 542.05 4 0 542.05
4 541.07 3 0 542.05
I trying the code.
data['Maxrol'] = data['Value'].rolling(window=int(data.iloc[-1,1])).max().shift(1).fillna(0)
and I am getting all zero value output. Please help to get the desired value