I am trying to move some data in a pandas data frame.
I have this data now:
My expected behavior is:
So when col B = date/time
the col B-E are shifted by one.
I am trying to move some data in a pandas data frame.
I have this data now:
My expected behavior is:
So when col B = date/time
the col B-E are shifted by one.
You can try this:
df.loc[1:,'B':] = df.loc[1:,'B':].shift(1, axis=1).fillna(0)
Output:
A B C D E
0 1 8 2011-06-01 ABC ABC
1 2 0 2011-06-01 ABC ABC