title: Conditionally iterate over columns in Pandas
body: <p>I have a Pandas dataframe for which I would like to return the number of unique values in each column, except that some columns should be excluded.</p>
  
  <p>This is how I am used to selecting unique values in a column, but I am not sure how to iterate it:</p>
  
  <pre><code>pd.unique(df.column_name.ravel())
  </code></pre>
  
  <p>My mind goes to something like this, but it obviously is not valid.</p>
  
  <pre><code>col_names = list(df.columns.values)
  dont_include = ['foo', 'bar']
  cols_to_include = [x for x in col_names if x not in dont_include]
  for i in cols_to_include:
   col_unique_count = len(pd.unique(df.i.ravel())
  </code></pre>
  
  <p>What is the best solution?</p>