title: Rolling Gradient for Pandas Dataframe column
body: <p>How can I create a column in a pandas dataframe with is the gradient of another column?</p>
  <p>I want the gradient to be run over a rolling window, so only 4 data points are assessed at one time.</p>
  <p>I am assuming it is something like:</p>
  <pre><code>df['Gradient'] = np.gradient(df['Yvalues'].rolling(center=False,window=4))
  </code></pre>
  <p>However this gives error:</p>
  <pre><code>    raise ValueError('Length of values does not match length of ' 'index')
  ValueError: Length of values does not match length of index
  </code></pre>
  <p>Any ideas?</p>
  <p>Thank you!!</p>