title: Simplest way to assign value labels / categories to existing data in Pandas
body: <p>I am working with datasets created by SPSS wherein labels can be added to numeric variables e.g. the numbers 1,2,3 could have the category A, B, C. </p>
  
  <p>For data visualisation it would be useful to reassign these labels once in Pandas. </p>
  
  <p>I have been able to achieve this using the code below but it seems overly complicated to define a new function every time I want to create new labels for existing data. </p>
  
  <p>Is there a more simple approach to achieving this? </p>
  
  <pre><code>import pandas as pd 
  
  sample_df = pd.DataFrame({'variable':[1,2,3,1,2,3],
                  'value':[50, 55, 65, 55,33,66]})
  
  def setCategory(c):
      if c['variable'] == 1:
          return 'A'
      elif c['variable'] == 2:
          return 'B'
      elif c['variable'] == 3:
          return 'C'
  
  sample_df['Category'] = sample_df.apply(setCategory, axis =1)
  </code></pre>