Created
July 12, 2017 04:46
-
-
Save QuantumDamage/4619f5e20f295d6b2aa3b71f6ef5e7b5 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
import pandas as pd | |
import numpy as np | |
dataTrain = pd.DataFrame({'county': ['Cochice', 'Pima', 'Santa Cruz', 'Maricopa', 'Yuma']}) | |
dummiesTrain = pd.get_dummies(dataTrain) | |
dataLive = pd.DataFrame({'county': ['Santa Cruz','Poznań', 'Pima']}) | |
dummiesLive = pd.get_dummies(dataLive) | |
dummiesLive | |
dummiesTrain | |
dummiesLive.reindex(columns = dummiesTrain.columns, fill_value=0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment