If I am having a variable with two values (for example Sex can take male or female), I use code like,
train_df["Sex"] = train_df["Sex"].apply(lambda sex: 0 if sex == 'male' else 1)
to convert string to integer. What is the way to do it if the variable takes more than 2 values, like Salary categorised as low/medium/high? How to assign value similarly as above?