how to make a variable categorical in python code example
Example 1: how to convert categorical data to binary data in python
MedInc False
HouseAge False
AveRooms False
AveBedrms False
Population False
AveOccup False
Latitude False
Longitude False
Price False
dtype: bool
Example 2: using df.astype to select categorical data and numerical data
df.satisfaction.astype("category",
ordered=True,
categories=ordered_satisfaction
)