RIP
Tutorial
Tags
Topics
Examples
eBooks
Tutorial by Examples
Shifting or lagging values in a dataframe
import pandas as pd df = pd.DataFrame({'eggs': [1,2,4,8,], 'chickens': [0,1,2,4,]}) df # chickens eggs # 0 0 1 # 1 1 2 # 2 2 4 # 3 4 8 df.shift() # chickens eggs # 0 NaN NaN # 1 0.0 1.0 # 2 1.0 2.0 ...
Page 1 of 1
1
Cookie
This website stores cookies on your computer.
We use cookies to enhance your experience on our website and deliver personalized content.
For more details on our cookie usage, please review our
Cookie Policy
and
Privacy Policy
Accept all Cookies
Leave this website