title: Efficiently creating additional columns in a pandas DataFrame using .map()
body: <p>I am analyzing a data set that is similar in shape to the following example. I have two different types of data (<em>abc</em> data and <em>xyz</em> data):</p>
  
  <pre><code>   abc1  abc2  abc3  xyz1  xyz2  xyz3
  0     1     2     2     2     1     2
  1     2     1     1     2     1     1
  2     2     2     1     2     2     2
  3     1     2     1     1     1     1
  4     1     1     2     1     2     1
  </code></pre>
  
  <p>I want to create a function that adds a categorizing column for each <em>abc</em> column that exists in the dataframe. Using lists of column names and a category mapping dictionary, I was able to get my desired result.</p>
  
  <pre><code>abc_columns = ['abc1', 'abc2', 'abc3']
  xyz_columns = ['xyz1', 'xyz2', 'xyz3']
  abc_category_columns = ['abc1_category', 'abc2_category', 'abc3_category']
  categories = {1: 'Good', 2: 'Bad', 3: 'Ugly'}
  
  for i in range(len(abc_category_columns)):
      df3[abc_category_columns[i]] = df3[abc_columns[i]].map(categories)
  
  print df3
  </code></pre>
  
  <p>The end result:</p>
  
  <pre><code>   abc1  abc2  abc3  xyz1  xyz2  xyz3 abc1_category abc2_category abc3_category
  0     1     2     2     2     1     2          Good           Bad           Bad
  1     2     1     1     2     1     1           Bad          Good          Good
  2     2     2     1     2     2     2           Bad           Bad          Good
  3     1     2     1     1     1     1          Good           Bad          Good
  4     1     1     2     1     2     1          Good          Good           Bad
  </code></pre>
  
  <p>While the <code>for</code> loop at the end works fine, I feel like I should be using Python's <code>lambda</code> function, but can't seem to figure it out. </p>
  
  <p>Is there a more efficient way to map in a dynamic number of <em>abc</em>-type columns?</p>