title: pandas: Combining Multiple Categories into One
body: <p>Let's say I have categories, 1 to 10, and I want to assign <code>red</code> to value 3 to 5, <code>green</code> to 1,6, and 7, and <code>blue</code> to 2, 8, 9, and 10.</p>
  
  <p>How would I do this? If I try</p>
  
  <pre><code>df.cat.rename_categories(['red','green','blue'])
  </code></pre>
  
  <p>I get an error: <code>ValueError: new categories need to have the same number of items than the old categories!</code> but if I put this in</p>
  
  <pre><code>df.cat.rename_categories(['green','blue','red', 'red', 'red'
                          'green', 'green', 'blue', 'blue' 'blue'])
  </code></pre>
  
  <p>I'll get an error saying that there are duplicate values.</p>
  
  <p>The only other method I can think of is to write a for loop that'll go through a dictionary of the values and replace them. Is there a more elegant of resolving this?</p>