title: Python Pandas, apply function
body: <p>I am trying to use apply to avoid an <code>iterrows()</code> iterator in a function:</p>
  
  <p>However that pandas method is poorly documented and I can't find example on how to use it, except for the lame <code>.apply(sq.rt)</code> in the documentation... No example on how to use arguments etc...</p>
  
  <p>Anyway, here a toy example on what I try to do.</p>
  
  <p>In my understanding <code>apply</code> will actually do the same as <code>iterrows()</code>, ie, iterate (over the rows if axis=0). On each iteration the input <code>x</code> of the function should be the row iterated over. However the error messages I keep receiving sort of disprove that assumption...</p>
  
  <pre><code>grid = np.random.rand(5,2)
  df = pd.DataFrame(grid)
  
  def multiply(x):
      x[3]=x[0]*x[1]
  
  df = df.apply(multiply, axis=0)
  </code></pre>
  
  <p>The example above returns an empty df. Can anyone shed some light on my misunderstanding?</p>