title: Creating sequential ID in panda dataframe for given column values
body: <p>I would like to create a unique sequential ID for each given values in the "Type" column but can't seem to make it work. </p>
  
  <p>Current data frame:</p>
  
  <pre><code>    Item    Type    ID
  0   Apple   Fruit   0
  1   Orange  Fruit   1
  2   Banana  Fruit   2
  3   Peach   Fruit   3
  4   Cheese  Dairy   0
  5   Milk    Dairy   1
  6   Chicken Meat    0
  7   Pork    Meat    1
  8   Beef    Meat    2
  </code></pre>
  
  <p>Desired data frame:</p>
  
  <pre><code>    Item    Type    ID
  0   Apple   Fruit   0
  1   Orange  Fruit   1
  2   Banana  Fruit   2
  3   Peach   Fruit   3
  4   Cheese  Dairy   0
  5   Milk    Dairy   1
  6   Chicken Meat    0
  7   Pork    Meat    1
  8   Beef    Meat    2
  </code></pre>
  
  <p>I've tried to set_index and creating a separate column that indicating "Type" value change but was not able to create the desired format. Any help is appreciated. </p>