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.
Current data frame:
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
Desired data frame:
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
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.