title: How to iterate to calculate a set of values in a new column
body: <p>I am trying to create a new column "roc_30d" using another column "rand_price". The new column is essentially rate of change 30 days. The formula would be (current price - price 30 periods ago) / (price 30 periods ago).  </p>
  
  <p>I've tried to iterate over "rand_price" in order to calculate the values of the new column. However, to no avail. Would appreciate it greatly for any advice! </p>
  
  <pre><code>for i in df['rand_price']:
      results = (i-(i-30) / (i-30))
      df['roc_30d'] = results
  </code></pre>
  
  <p>In the end, variables i and results has only 1 nan value. Ideally I want the new column to look at the attached png. </p>