title: How to get values from Series using column names?
body: <p>I get the list of column names as follows:</p>
  
  <pre><code>featuresA = [str(col) + '_x' for col in group.index]
  </code></pre>
  
  <p>where group is Series. I receive a list of 10 column names like 'Col1_x', 'Col2_x', etc.</p>
  
  <p>Now I want to read Series values into a DataFrame object:</p>
  
  <pre><code>mergedrow = pd.DataFrame()
  mergedrow[featuresA] = group[featuresA]
  </code></pre>
  
  <p>The error message says:</p>
  
  <pre><code>raise KeyError('%s not in index' % objarr[mask])
  </code></pre>
  
  <p>When I directly convert <code>group</code> to DataFrame using group.to_frame(), the result is 0.</p>
  
  <p>The complete code looks as follows:</p>
  
  <pre><code>featuresA = [str(col) + '_x' for col in group.index]
  featuresB = [str(col) + '_y' for col in match.iloc[[idx]].columns]
  mergedrow = pd.DataFrame()
  mergedrow[featuresA] = group[featuresA]
  mergedrow[featuresB] = match.iloc[[idx]]
  </code></pre>
  
  <p>UPDATE:
  This is the whole error message:</p>
  
  <pre><code>    raise KeyError('%s not in index' % objarr[mask])
  KeyError: "['airportResources.baggage_x' 'airportResources.arrivalTerminal_x'\n 'arrivalAirportFsCode_x' 'operationalTimes.scheduledGateArrival.dateLocal_x'\n 'schedule.flightType_x' 'schedule.serviceClasses_x' 'status_x'\n 'operationalTimes.actualDateTime_x'] not in index"
  </code></pre>