Calculating time deltas between rows in a Pandas dataframe
Use the diff().

    x['time_delta'] = x.timestamp.diff().fillna(x['time_delta'])


This works as below, in a simpler example. 

You could use the diff() Series method (with fillna to replace the first value in the series):

s = pd.Series([11, 13, 56, 60, 65])
s.diff().fillna(s)
0    11
1     2
2    43
3     4
4     5
dtype: float64


This was compiled from the comments below the current best answer (which I failed to see and kept searching), and the stack overflow link that explained it with fillna so I am hoping this can be lifted up to the top for future seekers. Happy data processing!