title: New column using apply function on other columns in dataframe
body: <p>I have a dataframe where three of the columns are coordinates of data ('H_x', 'H_y' and 'H_z'). I want to calculate radius-vector of the data and add it as a new column in my dataframe. But I have some kind of problem with pandas apply function.
  My code is:</p>
  
  <pre><code>def radvec(x, y, z):
      rv=np.sqrt(x**2+y**2+z**2)
      return rv
  
  halo_field['rh_field']=halo_field.apply(lambda row: radvec(row['H_x'], row['H_y'], row['H_z']), axis=1)
  </code></pre>
  
  <p>The error I'm getting is:</p>
  
  <pre><code>group_sh.py:78: SettingWithCopyWarning: 
  A value is trying to be set on a copy of a slice from a DataFrame.
  Try using .loc[row_indexer,col_indexer] = value instead
  
  See the caveats in the documentation: http://pandas.pydata.org/pandas- 
  docs/stable/indexing.html#indexing-view-versus-copy
  halo_field['rh_field']=halo_field.apply(lambda row: radvec(row['H_x'], row['H_y'], row['H_z']), axis=1)
  </code></pre>
  
  <p>I get column that I want, but I'm still confused with this error message.
  I'm aware there are similar questions here, but I couldn't find how to solve my problem. I'm fairly new to python. Can you help?</p>
  
  <p><strong>Edit:</strong> <code>halo_field</code> is a slice of another dataframe:</p>
  
  <pre><code>halo_field = halo_res[halo_res.N_subs==1] 
  </code></pre>