Created
September 23, 2019 23:04
-
-
Save oneryalcin/ee3a7adf7a7d593b197eeb0a31f96a19 to your computer and use it in GitHub Desktop.
9 StringIndexer and OneHotEncoder
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
joined = StringIndexer(inputCol='gender', outputCol='gender_idx')\ | |
.fit(joined)\ | |
.transform(joined) | |
joined = StringIndexer(inputCol='level', outputCol='level_idx')\ | |
.fit(joined)\ | |
.transform(joined) | |
joined = OneHotEncoderEstimator(inputCols=['gender_idx', 'level_idx'], | |
outputCols=['gender_dummy','level_dummy'])\ | |
.fit(joined)\ | |
.transform(joined) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment