Pandas Shift Converts Ints to Float AND Rounds
Because you know what happens when int
is casted as float due to np.nan
and you know that you don't want the np.nan
rows anyway, you can shift yourself with numpy
df[1:].assign(prior_epoch=df.epoch.values[:-1]) epoch prior_epoch1 1495571400260585120 14955714002593175002 1495571400260757200 14955714002605851203 1495571400260866800 1495571400260757200