Created
December 2, 2019 15:02
-
-
Save risenW/6b10d33001a265ab33e4df286fa175e5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import category_encoders as ce | |
# drop target column | |
target = train['Claim'].values | |
train.drop(columns='Claim', axis=1, inplace=True) | |
enc = ce.OrdinalEncoder(cols=['Geo_Code']) | |
enc.fit(train) | |
train_enc = enc.transform(train) | |
test_enc = enc.transform(test) | |
#one-hot-encode the rest categorical features | |
hot_enc = ce.OneHotEncoder() | |
hot_enc.fit(train_enc) | |
train_enc = hot_enc.transform(train_enc) | |
test_enc = hot_enc.transform(test_enc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment