+ 1
python rolling
Hi! Could somebody help me with such a problem: I have next code: import pandas as pd import numpy as np s = pd.Series(np.linspace(0, 20, 15)) r = s.rolling(2)........ I need to divide each element of this series on previous one. For example, if I have a series: 1,2,3 , then I want to get NaN, 2, 1.5
1 Odpowiedź
+ 3
s.div(s.shift(periods=1))
https://code.sololearn.com/c19bC77PIbPL/?ref=app