title: How can I add rows in pandas by using "loc" and "for"?
body: <p>I want to add a data of dataframe to new dataframe by "loc". I used "loc" but an error was occurred. Can I add a data?</p>
  
  <pre><code>&gt;&gt;&gt; import pandas as pd    
  &gt;&gt;&gt; df = pd.DataFrame({'A': [1.0, 1.2, 3.4, 4.1, 8.2]})
  &gt;&gt;&gt; import pandas as pd
  &gt;&gt;&gt; df_new = pd.DataFrame(columns=['A'])
  &gt;&gt;&gt; for i in df:
  ...     df_new.loc[i] = df.loc[i]
  ... 
  Traceback (most recent call last):
    File "/Users/Hajime/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py", line 1434, in _has_valid_type
      error()
    File "/Users/Hajime/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py", line 1429, in error
      (key, self.obj._get_axis_name(axis)))
  KeyError: 'the label [A] is not in the [index]'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 2, in &lt;module&gt;
    File "/Users/Hajime/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py", line 1328, in __getitem__
      return self._getitem_axis(key, axis=0)
    File "/Users/Hajime/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py", line 1551, in _getitem_axis
      self._has_valid_type(key, axis)
    File "/Users/Hajime/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py", line 1442, in _has_valid_type
      error()
    File "/Users/Hajime/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py", line 1429, in error
      (key, self.obj._get_axis_name(axis)))
  KeyError: 'the label [A] is not in the [index]'
  </code></pre>
  
  <p>But an following code is succeed.</p>
  
  <pre><code>&gt;&gt;&gt; df_new.loc[1] = df.loc[1]
  &gt;&gt;&gt; df_new
       A
  1  1.2
  </code></pre>