title: Pandas: Select values from specific columns of a DataFrame by row
body: <p>Given a DataFrame with multiple columns, how do we select values from specific columns by row to create a new Series?</p>
  
  <pre class="lang-python prettyprint-override"><code>df = pd.DataFrame({"A":[1,2,3,4], 
                     "B":[10,20,30,40], 
                     "C":[100,200,300,400]})
  columns_to_select = ["B", "A", "A", "C"]
  </code></pre>
  
  <p>Goal:
  <code>[10, 2, 3, 400]</code></p>
  
  <p>One method that works is to use an apply statement.</p>
  
  <pre class="lang-python prettyprint-override"><code>df["cols"] = columns_to_select
  df.apply(lambda x: x[x.cols], axis=1)
  </code></pre>
  
  <p>Unfortunately, this is not a vectorized operation and takes a long time on a large dataset. Any ideas would be appreciated.</p>