Created
October 30, 2020 00:15
-
-
Save aagnone3/3fe5a6daf939bcf23f9128970e0f0fc6 to your computer and use it in GitHub Desktop.
sf_crime_4.py
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
# drop unused columns | |
train.drop(["DayOfWeek", "Resolution", "Descript"], axis=1, inplace=True) | |
# target certain crime event categories | |
targeted_cats = [ | |
'LARCENY/THEFT' | |
] | |
train["TargetedCategory"] = train.Category.isin(targeted_cats) | |
train.drop("Category", axis=1, inplace=True) | |
print(f"The {len(targeted_cats)} targeted categories occur in {100. * train.TargetedCategory.mean():.2f}% of the samples.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment