title: Why do I get Pandas data frame with only one column vs Series?
body: <p>I've noticed single-column data frames a couple of times to much chagrin (examples below); but in most other cases a one-column data frame would just be a Series. Is there any rhyme or reason as to why a one column DF would be returned?</p>
  
  <p>Examples:</p>
  
  <p>1) when <strong>indexing columns by a boolean mask where the mask only has one true value</strong>:</p>
  
  <pre><code>df = pd.DataFrame([list('abc'), list('def')], columns = ['foo', 'bar', 'tar'])
  mask = [False, True, False]
  type(df.ix[:,mask])
  </code></pre>
  
  <p>2) when <strong>setting an index on DataFrame that only has two columns</strong> to begin with:</p>
  
  <pre><code>df = pd.DataFrame([list('ab'), list('de'), list('fg')], columns = ['foo', 'bar']
  type(df.set_index('foo'))
  </code></pre>
  
  <p>I feel like if I'm expecting a DF with only one column, I can deal with it by just calling </p>
  
  <pre><code>pd.Series(df.values().ravel(), index = df.index)
  </code></pre>
  
  <p>But in most other cases a one-column data frame would just be a Series. Is there any rhyme or reason as to why a one column DF would be returned?</p>