How to convert categorical variables into a numeric format in Python?