Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas shift all columns

import pandas as pd  
info= pd.DataFrame({'a_data': [45, 28, 39, 32, 18],  
'b_data': [26, 38, 41, 35, 45],  
'c_data': [22, 19, 11, 25, 16]})  

#shifting code
info.shift(periods=2)  

info.shift(periods=2,axis=1,fill_value= 70)  
Source by pandas.pydata.org #
 
PREVIOUS NEXT
Tagged: #pandas #shift #columns
ADD COMMENT
Topic
Name
1+4 =