title: recoding categorical variables in pandas
body: <p>I have a dataframe of categorical data that I would like to recode. Below is toy example of the code I have thus far</p>
  
  <pre><code>import pandas as pd
  ser = pd.DataFrame({'a':[1,3,3,1], 'b':[2,2,4,5]})
  print(ser)
  a_dict = {1:11, 3:33}
  b_dict = {2:22, 4:44, 5:55}
  ser.a = ser.a.map(a_dict)
  ser.b = ser.b.map(b_dict)
  print(ser)
  </code></pre>
  
  <p>Of course my real data has much more than 2 columns. Is there a more concise way of mapping (applying) over the entire dataframe? Each column would have it's separate dictionary of recoded values.</p>
  
  <p>Thanks in advance</p>
  
  <p>Leon</p>