Skip to content

Instantly share code, notes, and snippets.

@aagnone3
Created October 30, 2020 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aagnone3/3fe5a6daf939bcf23f9128970e0f0fc6 to your computer and use it in GitHub Desktop.
Save aagnone3/3fe5a6daf939bcf23f9128970e0f0fc6 to your computer and use it in GitHub Desktop.
sf_crime_4.py
# 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