python rolling | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

10th Jan 2020, 10:06 PM
Павел Ефремов
Павел Ефремов - avatar
1 Answer
10th Jan 2020, 10:48 PM
Tibor Santa
Tibor Santa - avatar