title: Apply rules to columns in pandas
body: <p>I have quick question. Is there a faster method to replace "for" loop? I want to apply "if" statement to grow out the data. sth like below. "for" loop is way too slow. I need to populate other more complex logic so appreciate any systematic methods to solve it.</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  s = pd.DataFrame(index=[np.arange(0,201,1)], columns=['myval'])
  for i in s.index:
      if 0&lt;=i&lt;=50:
          s.myval[i] = s.myval[i-1] * 1.05 if i &gt; 0 else 3
      else:
          s.myval[i] = (10 - s.myval[i-1]) * 0.8 + 10 * 0.2
  </code></pre>