Answers for "python categorical to numeric"

0

how to separate numeric and categorical variables in python

df.loc[:,df.dtypes==np.object]
Posted by: Guest on March-22-2021
3

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
1

how to convert categorical data to numerical data in python

pd.get_dummies(obj_df, columns=["body_style", "drive_wheels"], prefix=["body", "drive"]).head()
Posted by: Guest on May-26-2021

Code answers related to "python categorical to numeric"

Python Answers by Framework

Browse Popular Code Answers by Language