title: Use previous data in rolling in Python
body: <p>I would like to do the following in python</p>
  
  <p><img src="https://i.stack.imgur.com/FbQgp.png" height="20"></p>
  
  <p>Basically I have a table as following with y = 0.5</p>
  
  <pre><code>A | B | Result from column A
  ---
  1   2   0.5
  ---
  2   4   0.5*(0.5+ 2)
  ---
  3   5   ...
  ---
  4   4   ...
  ---
  </code></pre>
  
  <p>So far I have a loop, which is not efficient, I would like a vectorised way of doing it :</p>
  
  <pre><code>X = np.zeros((len(df),))
  for i, (_, row) in enumerate(df.iterrows()):
      if i == 0:
          continue
      X[i] = y*(X[i - 1] +  row['A'])
  </code></pre>
  
  <p>Can you please help me on the above</p>
  
  <p>Thank you</p>