I\'m trying to calculate the time difference between two rows using shift(), but I get an unexpected error. I may be missing something obvious
shift()
d
Perhaps confusingly, pre-1.0 Series.shift and Index.shift used to not exactly do the same thing, the latter only being meaningfully defined for TimesSeries. Probably easiest to add your index as a column.
df['index_col'] = df.index df['Delta']=(df['index_col'] - df['index_col'].shift(1))