I have a dataframe df like this:
Student_id Subject Performance_level
10010 mathematics Satisfactory
10011 Physics Poor
10012 Chemistry Neutral
10013 Physics Poor
10014 History Neutral
I want to use label encoding the column Performance_level with Poor as 1 and Neutral as 2 and Satisfied as 3(i.e, order or ranking is important)
By default label encoding sorts according to Alphabetic order and assign corresponding Numerical value. How to customize this to the specific values like Poor as 1 and Neutral as 2 and Satisfied as 3.
Student_id Subject Performance_level Performance_level_encoded
10010 mathematics Satisfactory 3
10011 Physics Poor 1
10012 Chemistry Neutral 2
10013 Physics Poor 1
10014 History Neutral 2