Given that I have the following two vectors:
In [99]: time_index Out[99]: [1484942413, 1484942712, 1484943012, 1484943312, 1484943612, 1484943912, 1484944
Or if you'd like to calculate the rate of change you can just use df.pct_change()
df.pct_change()
As a parameter you can enter df.pct_change(n), where n is the lookback period assuming you have a datetime indexed dataframe.
df.pct_change(n)
n