title: How to identify the columns with more than 20 unique values in pandas for all columns
body: <p>Need to segregate only the columns with more than 20 unique values for all the columns in pandas_python (this is a solution for that): if anything else better, please comment:</p>
  
  <pre><code>enter code here
  col_with_morethan_20_unique_values_cat=[]
  for col in data.columns:
      if data[col].dtype =='O':
          if len(data[col].unique()) &gt;20:
              col_with_morethan_20_unique_values_cat.append(data[col].name)
          else:
              continue
  
  print(col_with_morethan_20_unique_values_cat)
  print('total number of columns with more than 20 number of unique value is',len(col_with_morethan_20_unique_values_cat))
  
  
  
   # The o/p will be as:
  ['CONTRACT NO', 'X2','X3',,,,,,,..]
  total number of columns with more than 20 number of unique value is 25
  </code></pre>