title: How to select column based on condition in row?
body: <p>I have a dataframe df, and want to select only the columns that have a specific value &quot;xyz&quot; in row [0].</p>
  <p>I know if I were trying to select rows with a specific value &quot;xyz&quot; in column [0] I would just do:</p>
  <pre><code>df[df[0] == 'xyz']
  </code></pre>
  <p>Now I try:</p>
  <pre><code>df[df.loc[0] == 'xyz']
  </code></pre>
  <p>and I get error:</p>
  <pre><code>IndexingError: Unalignable boolean Series provided as indexer (index of the boolean Series and of the indexed object do not match
  </code></pre>
  <p>Why won't the same operation work for selecting columns with a condition? And what's the easiest solution to get just the columns I want?</p>