In Python, pandas is a separate library from Matlab. If you want to shift a column forwards in pandas, you can use the shift()
method. Here's an example:
main.py196 chars10 lines
This will output the following DataFrame:
main.m84 chars7 lines
Note that shifting a column forwards will result in the first value becoming NaN
. If you want to shift the column backwards, you can use a negative integer argument to the shift()
method.
gistlibby LogSnag