title: for loop for calculations from dataframes
body: <p>So, I have a text file which I have turned into a dataframe.  I'm basically just trying to loop over every value from column H and Z, square each of them and then take the square root (Pythagoras' theorem in other words).  I.E. </p>
  
  <pre><code>F = sqrt(H**2 + Z**2).
  </code></pre>
  
  <p>My data:(after its been turned into a pandas dataframe)</p>
  
  <pre><code>    H        D       Z
  0   3235     6764    9546
  1   1667     3455    7776
  2   3555     3564    5433
  3   2344     3333    8777
  4   5666     3334    4444
  </code></pre>
  
  <p>That's a tiny snippet of the data.  There are about 1000> rows of data here. </p>
  
  <p>Code:</p>
  
  <pre><code>import pandas as pd
  
  #load data:
  
  df=pd.read_table('example_data.txt', sep='\s+')
  
  from math import sqrt
  for x,y in df:
      F=sqrt(H**2+Z**2)
      print(F)
  </code></pre>
  
  <p>The error produced:</p>
  
  <pre><code>ValueError                                Traceback (most recent call last)
  &lt;ipython-input-34-1b1be5be91d0&gt; in &lt;module&gt;()
          1 from math import sqrt
    ----&gt; 2 for x,y in df:
          3     F=sqrt(H**2+Z**2)
          4     print(F)
          5 
  
          ValueError: too many values to unpack (expected 2)
  </code></pre>
  
  <p>So that's it.  This is an easy question I feel, but one a Python beginner can't seem to solve.  Its essentially repeating a calculation many times over with 2 variables.  I've seen it with 1 variable but not 2.</p>
  
  <p>Any help would be greatly appreciated,</p>
  
  <p>Cheers!</p>