title: Pandas use variable for column names
body: <p>Given the following data frame:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  df = pd.DataFrame({'A':[1,2,3],
                     'B':[4,5,6],
                     'C':[7,8,9]})
  
  df
  
      A   B   C
  0   1   4   7
  1   2   5   8
  2   3   6   9
  </code></pre>
  
  <p>How can I access columns via a variable?</p>
  
  <p>I tried this:</p>
  
  <pre><code>cols='A','B'
  df[cols]
  </code></pre>
  
  <p>...which resulted in this:</p>
  
  <pre><code>KeyError: ('A', 'B')
  </code></pre>
  
  <p>Bonus Question:
  What if my data frame were like this?:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  df = pd.DataFrame({'A':[1,2,3],
                     'B':[4,5,6],
                     'C':[7,8,9],
                     'D':[1,3,5],
                     'E':[5,3,6],
                     'F':[7,4,3]})
  
  df
  
      A   B   C   D   E   F
  0   1   4   7   1   5   7
  1   2   5   8   3   3   4
  2   3   6   9   5   6   3
  </code></pre>
  
  <p>and I wanted to do this?:</p>
  
  <pre><code>cols=['A','B']
  cols2=['C','D']
  df[cols,'F',cols2]
  </code></pre>
  
  <p>Thanks in advance!</p>