I have 10 unique values in one column from my dataframe. For example below is the dataframe
df['categories'].unique()
output is :
Electronic
Computers
Mobile Phone
Router
Food
I want to replace 'Electronic' with 1, 'Computers' with 2, 'Mobile Phone' with 3, 'Router' with 4 and 'Food' with 5. The expected output must be
df['categories'].unique()
Expected output:
1
2
3
4
5
I tried looping the df['categories'].unique(), but i'm unable to do that. Can anyone help me with this?