title: pandas - mask dataframe by column name
body: <p>Starting from this simple dataframe <code>df</code>:</p>
  
  <pre><code>col1,col2
  1,3
  2,1
  3,8
  </code></pre>
  
  <p>I would like to apply a boolean <code>mask</code> in function of the name of the column. I know that it is easy for values:</p>
  
  <pre><code>mask = df &lt;= 1
  
  df = df[mask]
  </code></pre>
  
  <p>which returns:</p>
  
  <p>mask:</p>
  
  <pre><code>    col1   col2
  0   True  False
  1  False   True
  2  False  False
  </code></pre>
  
  <p>df:</p>
  
  <pre><code>   col1  col2
  0     1   NaN
  1   NaN     1
  2   NaN   NaN
  </code></pre>
  
  <p>as expected. Now I would like to obtain a boolean mask based on the column name, something like:</p>
  
  <pre><code>mask = df == df['col_1']
  </code></pre>
  
  <p>which should return:</p>
  
  <p>mask</p>
  
  <pre><code>    col1   col2
  0   True  False
  1   True  False
  2   True  False
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>This seems weird, but I need those kind of masks to later filtering by columns seaborn heatmaps.</p>