Answers for "transform categorical variables python"

2

transform categorical variables python

from sklearn.preprocessing import LabelEncoder

lb_make = LabelEncoder()
obj_df["make_code"] = lb_make.fit_transform(obj_df["make"])
obj_df[["make", "make_code"]].head(11)
Posted by: Guest on May-20-2020

Code answers related to "transform categorical variables python"

Python Answers by Framework

Browse Popular Code Answers by Language