Created
June 23, 2019 22:18
-
-
Save wtberry/3891f6fa0dd8064351ee58529a6af412 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
from sklearn.preprocessing import OrdinaryEncoder | |
# creating mapping from unique label texts to unique integers | |
# note this can be re-used to encode and decode the labels after as well | |
encoder = OrdinaryEncoder().fit(df['code']) | |
# using the encoder to encode the entire dataset | |
y = encoder.transform(encoder) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment