title: Compute forward difference with Dask DataFrame?
body: <p>How do I compute the first discrete difference using Dask DataFrame?  Or, in "Pandas speak", how do I do <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.diff.html" rel="nofollow noreferrer"><code>pandas.DataFrame.diff()</code></a> in Dask?  Mathematically, the operation is very simple: subtract a column vector from a copy of itself shifted by one or more rows.</p>
  
  <p>I have tried implementing <code>diff()</code> in Dask in the following ways, none of which works (yet):</p>
  
  <ul>
  <li><code>df - df.shift(periods=1)</code> works in Pandas.  But Dask DataFrame doesn't have a <code>shift()</code> method.</li>
  <li><code>df.values[:-1] - df.values[1:]</code> works in Pandas.  But I can't see how to index into a Dask DataFrame by <em>position</em>.</li>
  </ul>
  
  <p>My current best idea for implementing <code>diff</code> would be to wrap some custom code in <code>dask.dataframe.rolling.wrap_rolling</code>, as suggested in <a href="https://stackoverflow.com/questions/34225275/shifting-all-rows-in-dask-dataframe/34226468#34226468">this stack overflow answer</a> (although I haven't been able to find any documentation on <em>how to do this</em>).  Or wrap some custom code using Dask Delayed?  Any other thoughts?</p>