title: Unable to write function for df.columns to factorize()
body: <p>I have a dataframe df:</p>
  
  <pre><code>age           45211 non-null int64
  job           45211 non-null object
  marital       45211 non-null object
  default       45211 non-null object
  balance       45211 non-null int64
  housing       45211 non-null object
  loan          45211 non-null object
  contact       45211 non-null object
  day           45211 non-null int64
  month         45211 non-null object
  duration      45211 non-null int64
  campaign      45211 non-null int64
  pdays         45211 non-null int64
  previous      45211 non-null int64
  poutcome      45211 non-null object
  conversion    45211 non-null int64
  </code></pre>
  
  <p>I want to do two things:</p>
  
  <p>(1) I want to create two sub-dataframes which will be automatically separated by dtype=object and dtype=int64. I thought of something like this:</p>
  
  <pre><code>object_df=[]
  int_df=[]
  
  for i in df.columns:
     if dtype=object:
         *add column to object_df*
     else:
         *add column to int_df*
  </code></pre>
  
  <p>(2) Next, I want to use the columns from <code>object_df['job','marital','default','housing','loan','contact','month','poutcome']</code> and write a function which factorizes each column, so that categories will be converted to numbers. I thought of something like this:</p>
  
  <pre><code>job_values,job_labels= df['job'].factorize()
  df['job_fac']=job_values
  </code></pre>
  
  <p>Since I would have to copy and paste those for all columns in the object_df, is there a way to write a neat dynamic function?</p>