# get all categorical columns in the dataframe
catCols = [col for col in df1.columns if df1[col].dtype=="O"]
from sklearn.preprocessing import LabelEncoder
lb_make = LabelEncoder()
for item in catCols:
df1[item] = lb_make.fit_transform(df1[item])
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)
pd.get_dummies(obj_df, columns=["body_style", "drive_wheels"], prefix=["body", "drive"]).head()
obj_df["body_style"] = obj_df["body_style"].astype('category')
obj_df.dtypes
## Converting Age to numeric variable
df['Gender']=pd.get_dummies(df['Gender'],drop_first=1)
df.head()