title: Pandas DataFrame: Assign values from a column to a subset of original dataframe without copying
body: <p>I want to assign the values of a column in a DataFrame to a subset of another column in the same original DataFrame. Consider the following example:</p>
  
  <pre><code>df = pd.DataFrame(np.random.randn(8, 4), index=[0,1,1,2,1,3,4,5], columns=['A', 'B', 'C', 'D'])
  df['str'] = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a']
  df.loc[1, 'B'] = df.loc[1, 'A']
  </code></pre>
  
  <p>For all values where the index is <code>1</code>, I want to assign the value of column <code>'A'</code> to column <code>'B'</code>. This operation is to be applied to the original DataFrame and not a copy.</p>
  
  <p>The above example fails with the following error</p>
  
  <pre><code>ValueError                                Traceback (most recent call last)
  &lt;ipython-input-144-29c8017817b2&gt; in &lt;module&gt;()
        2 df['str'] = ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a']
        3 display(df)
  ----&gt; 4 df.loc[1, 'B'] = df.loc[1, 'A']
        5 display(df)
  
  ~/anaconda/envs/snakes36/lib/python3.6/site-packages/pandas/core/indexing.py in __setitem__(self, key, value)
      177             key = com._apply_if_callable(key, self.obj)
      178         indexer = self._get_setitem_indexer(key)
  --&gt; 179         self._setitem_with_indexer(indexer, value)
      180 
      181     def _has_valid_type(self, k, axis):
  
  ~/anaconda/envs/snakes36/lib/python3.6/site-packages/pandas/core/indexing.py in _setitem_with_indexer(self, indexer, value)
      577 
      578                     if len(labels) != len(value):
  --&gt; 579                         raise ValueError('Must have equal len keys and value '
      580                                          'when setting with an iterable')
      581 
  
  ValueError: Must have equal len keys and value when setting with an iterable
  </code></pre>
  
  <p>The problem seems to be column <code>str</code> which is of different type than the other <code>float64</code> columns. If I remove column <code>str</code>, the code above works perfectly. Which I do not understand as I assumed my <code>.loc</code> operations only select columns <code>A</code> and <code>B</code>.</p>
  
  <p>The problem is: My DataFrame consists of ~50 columns with different types.</p>
  
  <p>Is there a better approach to solve this?</p>