What is the best way to keep column names after doing one hot encoder in python? All my features are categorical so I did like below: so, after import the dataset it looks like below
PlaceID Date ... BlockedRet OverallSeverity
0 23620 1/10/2019 ... 1 1
1 13352 1/10/2019 ... 1 1
2 13674 1/10/2019 ... 1 1
3 13501 1/10/2019 ... 1 1
4 13675 1/10/2019 ... 1 1
[5 rows x 28 columns]
after choosing the features, I want to transform them using one hot encoder because most of them are categorical, my question after doing that using:
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
hotencode = OneHotEncoder(categorical_features=[0])
features = hotencode.fit_transform(features).toarray()
enter image description here the result comes without original column names, how can I transform them with the same column name+0.,1,2,3.