Last active
January 13, 2019 22:09
-
-
Save pascalwhoop/af7306838b3163dd83bfabf4a4e60dfa to your computer and use it in GitHub Desktop.
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import helpers\n", | |
"from sklearn import preprocessing\n", | |
"X_test, y_test = helpers.get_data(subset=\"test\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"array(['Cambodia', 'Canada', 'China', 'Columbia', 'Cuba',\n", | |
" 'Dominican-Republic', 'Ecuador', 'El-Salvador', 'England',\n", | |
" 'France', 'Germany', 'Greece', 'Guatemala', 'Haiti', 'Honduras',\n", | |
" 'Hong', 'Hungary', 'India', 'Iran', 'Ireland', 'Italy', 'Jamaica',\n", | |
" 'Japan', 'Laos', 'Mexico', 'Nicaragua',\n", | |
" 'Outlying-US(Guam-USVI-etc)', 'Peru', 'Philippines', 'Poland',\n", | |
" 'Portugal', 'Puerto-Rico', 'Scotland', 'South', 'Taiwan',\n", | |
" 'Thailand', 'Trinadad&Tobago', 'United-States', 'Vietnam',\n", | |
" 'Yugoslavia', 'nan'], dtype=object)" | |
] | |
}, | |
"execution_count": 12, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"le = preprocessing.LabelEncoder()\n", | |
"le.fit(X_test['native-country'].astype(str))\n", | |
"le.classes_" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.7" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment