Last active
August 13, 2020 04:10
-
-
Save omairaasim/06bf7c949578379b1ec2860c841ec41f to your computer and use it in GitHub Desktop.
project_2_step_2_convert_text_to_numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 2 - Encode Categorical Data | |
from sklearn.preprocessing import OneHotEncoder | |
from sklearn.compose import ColumnTransformer | |
import numpy as np | |
ct = ColumnTransformer(transformers=[('encoder',OneHotEncoder(),[3])], remainder='passthrough') | |
X = np.array(ct.fit_transform(X)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment