title: How to get the column having cat
body: <p>dataset is below</p>
  
  <pre><code>id,cost,product,cost_cat,product_cat
  1,12,34,100,200
  2,13,35,101,201
  3,14,36,102,202
  4,15,37,103,203
  5,16,38,104,204
  </code></pre>
  
  <p>How to get the column <code>cost_cat,product_cat</code> or </p>
  
  <pre><code>import pandas as pd
  df = pd.read_csv('1.csv')
  df1 = df[['cost_cat','product_cat']]
  </code></pre>
  
  <ul>
  <li><p>I need to delete the column name which doesn't having  <code>cat</code> and create a new dataframe</p></li>
  <li><p>I need to select the column name which having  <code>cat</code> and create a new dataframe</p></li>
  <li><p>I need to select the first column <code>df.iloc[:,0]</code> and the find the column which is having the `cat</p></li>
  </ul>
  
  <p>Psuedo code which throw indexerror</p>
  
  <pre><code>df.loc[:,df.columns.str.contains('cat'),df.iloc[:,0] ]
  </code></pre>
  
  <p>I got the solution by adding </p>
  
  <p><code>df.loc[:,df.columns.str.contains('cat')| df.columns.str.contains('id')]</code> </p>
  
  <p>but i need to get the with number like <code>df.iloc[:,0]</code></p>