Created
May 16, 2018 14:08
-
-
Save WillKoehrsen/5803cedcbf6f697bd9bdbfcbed759cda 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
# Replace all occurrences of Not Available with numpy not a number | |
data = data.replace({'Not Available': np.nan}) | |
# Iterate through the columns | |
for col in list(data.columns): | |
# Select columns that should be numeric | |
if ('ft²' in col or 'kBtu' in col or 'Metric Tons CO2e' in col or 'kWh' in | |
col or 'therms' in col or 'gal' in col or 'Score' in col): | |
# Convert the data type to float | |
data[col] = data[col].astype(float) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment