title: Python pandas: Finding derivatives from Dataframe
body: <p>My Dataframe looks like this:</p>
  
  <pre><code>                     date     time   sym        ask0        ask1        ask2  
  0     2017-08-21 07:00:00 07:00:00   7YR  100.812500  100.828125  100.843750   
  1     2017-08-21 07:00:15 07:00:15   7YR  100.812500  100.828125  100.843750   
  2     2017-08-21 07:00:30 07:00:30   7YR  100.812500  100.828125  100.843750   
  3     2017-08-21 07:00:45 07:00:45   7YR  100.812500  100.828125  100.843750   
  4     2017-08-21 07:01:00 07:01:00   7YR  100.812500  100.828125  100.843750   
  5     2017-08-21 07:01:15 07:01:15   7YR  100.812500  100.828125  100.843750   
  6     2017-08-21 07:01:30 07:01:30   7YR  100.812500  100.828125  100.843750   
  7     2017-08-21 07:01:45 07:01:45   7YR  100.812500  100.828125  100.843750   
  8     2017-08-21 07:02:00 07:02:00   7YR  100.812500  100.828125  100.843750   
  9     2017-08-21 07:02:15 07:02:15   7YR  100.812500  100.828125  100.843750   
  10    2017-08-21 07:02:30 07:02:30   7YR  100.812500  100.828125  100.843750   
  11    2017-08-21 07:02:45 07:02:45   7YR  100.828125  100.843750  100.859375   
  12    2017-08-21 07:03:00 07:03:00   7YR  100.812500  100.828125  100.843750   
  13    2017-08-21 07:03:15 07:03:15   7YR  100.828125  100.843750  100.859375   
  14    2017-08-21 07:03:30 07:03:30   7YR  100.828125  100.843750  100.859375   
  15    2017-08-21 07:03:45 07:03:45   7YR  100.828125  100.843750  100.859375   
  16    2017-08-21 07:04:00 07:04:00   7YR  100.828125  100.843750  100.859375   
  17    2017-08-21 07:04:15 07:04:15   7YR  100.828125  100.843750  100.859375   
  18    2017-08-21 07:04:30 07:04:30   7YR  100.828125  100.843750  100.859375   
  19    2017-08-21 07:04:45 07:04:45   7YR  100.828125  100.843750  100.859375   
  20    2017-08-21 07:05:00 07:05:00   7YR  100.828125  100.843750  100.859375   
  21    2017-08-21 07:05:15 07:05:15   7YR  100.828125  100.843750  100.859375   
  22    2017-08-21 07:05:30 07:05:30   7YR  100.828125  100.843750  100.859375 
  </code></pre>
  
  <p>I would like to calculate the derivative:
  <code>d = d(ask0)/dt</code></p>
  
  <p>where <code>dt = 2</code> minutes.</p>
  
  <p>So for example, </p>
  
  <pre><code>t = 2017-08-21 07:04:30 07:04:30    ask@t=100.828125 
  t-1 =  2017-08-21 07:04:30 07:02:30  ask@t-1=100.812500
  dask/dt = (100.828125-100.812500)/2 = 0.0078125
  </code></pre>
  
  <p>I know I can do this by iterating each row in the dataframe.</p>
  
  <p>But I was wondering if there is a Pandas function doing this job.</p>