Skip to content

Code Examples for Data Science for Crime Analysis with Python book

License

Notifications You must be signed in to change notification settings

apwheele/CrimeBook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CrimeBook

This is a code example for the an end-to-end project example for my Data Science for Crime Analysis with Python book. It shows creating data manipulation functions, as well as an automated CompStat report that updates with the newest data available.

The components are:

  • /src/prep.py, functions to download and prepare Cary crime data including, monthly counts, YTD metrics, and apartment complex stats
  • /src/viz.py, functions to create tables and graphs in the automated report
  • CaryReport.ipynb, jupyter notebook that is automated to calculate updated metrics

Contact: Andrew Wheeler

Executing the notebook

To create the report from the command line, you can run:

jupyter nbconvert --execute --no-input --allow-chromium-download --to webpdf CaryReport.ipynb

Creating the python environment

To create the python environment to run this code, I use conda:

conda create --name pybook python=3.10 pip
conda activate pybook
pip install -r requirements.txt

About

Code Examples for Data Science for Crime Analysis with Python book

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published