title: iterate over columns pandas to encode dtype object to categorical value
body: <p>I have a dataset full of categorical values that are not encoded at the moment. For instance, I have a variable called <code>condition</code> which has these values:
  <code>Very Excellent</code>, <code>Excellent</code>, <code>Very Good</code></p>
  
  <p>I want to encode these (give them integer values) so that I can use them as categorical dummy variables in a regression. However, I have lots of these in my Data Frame so I'd like to iterate over each column and encode all dtype objects.
  This is my attempt:</p>
  
  <pre><code>import pandas as pd
  from sklearn.preprocessing import LabelEncoder
  enc=LabelEncoder()
  
  for column in df_06:
      if df_06["column"].values==object:
          df_06["column"]=enc.fit_transform(df_06["column"])
  </code></pre>
  
  <p>My dataframe is</p>
  
  <p><img src="https://i.stack.imgur.com/pY7eK.png" alt="my df"></p>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p><code>&lt;ipython-input-48-ea6aec86108f&gt; in &lt;module&gt;()</code><br>
    <code>1 for column in df_06:</code><br>
    <code>----&gt;     2 if df_06[column].values==object:</code><br>
    <code>3 df_06[column]=enc.fit_transform(df_06[column])</code><br>
    <code>ValueError: The truth value of an array with more than one element is</code>
    <code>ambiguous. Use a.any() or a.all()</code></p>
  </blockquote>