title: Editing values in a pandas dataframe using data from another part of the dataframe
body: <p>I was hoping to use indexing on one part of a Pandas DataFrame to edit values
  corresponding to another index. Here is an example:</p>
  
  <pre><code>&gt;&gt;&gt; from pandas import *
  &gt;&gt;&gt; from numpy.random import randn
  &gt;&gt;&gt; x = DataFrame(randn(3, 3), columns=[1, 2, 3], index=['a', 'b', 'c'])
  &gt;&gt;&gt; print x
  
          1         2         3
  a -1.007344  0.234990  0.772736
  b  0.658360  1.330051 -0.269388
  c  0.010871  1.035687  0.230169
  
  
  &gt;&gt;&gt; index1 = x.index[0:2]
  &gt;&gt;&gt; index2 = x.index[1:3]
  &gt;&gt;&gt; y = x
  &gt;&gt;&gt; x.loc[index1, 3] = x.loc[index2, 2]
  &gt;&gt;&gt; print x
  
  
          1         2         3
  a -1.007344  0.234990       NaN
  b  0.658360  1.330051  1.330051
  c  0.010871  1.035687  0.230169
  </code></pre>
  
  <p>Where the latter output is rather unexpected. What does work instead is the following:</p>
  
  <pre><code>&gt;&gt;&gt; y.loc[index1, 3] = y.loc[index2, 2].values
  &gt;&gt;&gt; print y
  
         1         2         3
  a -1.007344  0.234990  1.330051
  b  0.658360  1.330051  1.035687
  c  0.010871  1.035687  0.230169
  </code></pre>
  
  <p>However, this latter solution is inconvenient for a number of applications I would like to use. For example, I would like to write:</p>
  
  <pre><code>x.loc[index1, 3] = x.loc[index2, 2]+2 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>x.loc[index1, 3] = x.loc[index1, 3] + x.loc[index2, 2]
  </code></pre>
  
  <p>etc.</p>
  
  <p>Is there another way around this problem?</p>
  
  <p>Thanks in advance!</p>