title: How to exclude and filter few columns in pandas?
body: <p>I know we can select only few columns using pandas dataframe filter, but can we also exclude only some columns?</p>
  
  <p>Here is MWE:</p>
  
  <pre class="lang-py prettyprint-override"><code>import numpy as np
  import pandas as pd
  
  
  df = pd.DataFrame({'id': [1,2,3], 'num_1': [10,20,30], 'num_2': [20,30,40]})
  
  df.filter(regex='num')
  </code></pre>
  
  <p>Can we select all columns not having 'num' in the columns:</p>
  
  <p>Something like:</p>
  
  <pre><code>df.filter(regex='^(num)')
  </code></pre>
  
  <p><strong>Required Output</strong>  </p>
  
  <pre><code>   id
  0   1
  1   2
  2   3
  </code></pre>
  
  <p><strong>Note</strong>  </p>
  
  <pre><code># these already works, i am only looking regex way
  df[['id']] # gives the required output
  
  </code></pre>
  
  <p>Reference:<br>
  <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.filter.html" rel="nofollow noreferrer">https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.filter.html</a></p>