title: pandas DataFrame columns named True and False work just fine
body: <p>The sample code:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  df = pd.DataFrame(np.random.rand(5,2), columns=[True, False])
  # All of the following works fine. Just like you would expect
  # them to, if the columns had any other (string) name.
  # (Because True == True, True == False and False == False are
  # valid comparisons -- they have to be.)
  df.loc[:, True]
  df.loc[:, False]
  df.loc[:, [col for col in df.columns if col]]
  df.loc[:, :]
  
  # However, the below line, only returns column `True`. But if
  # the names were strings, it would return both columns.
  df.loc[:, [True, False]]
  </code></pre>
  
  <p>What <a href="http://www.mememaker.net/static/images/memes/2707704.jpg" rel="nofollow">witchcraft</a> makes this possible? I thought some check for keys will fail. But they didn't and I had to ask because they didn't.</p>
  
  <p>So rephrasing my question: How does pandas (Python, for that matter) decide between Boolean and non-Boolean (for lack of better expression) indexing? How does it avoid confusion? And what prevents misbehavior? Had the first line (<code>df = pd.DataFrame(np.random.rand(5,2), columns=[True, False])</code>) returned a single column (<code>True</code>) I would have been less surprised.</p>