Created
June 3, 2022 05:45
-
-
Save schwa/f0310da5f5a1bc4e4f28de9455d47bee to your computer and use it in GitHub Desktop.
GunHeatmaps.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
# %% | |
import pandas as pd | |
import numpy as np | |
import datetime as dt | |
from datetime import datetime | |
import calmap | |
# Data from https://www.gunviolencearchive.org/ | |
#events = pd.read_csv('ChildrenKilled.csv', parse_dates=['Incident Date']) | |
events = pd.read_csv('MassShootings.csv', parse_dates=['Incident Date']) | |
events.head() | |
events = events.set_index('Incident Date') | |
# %% | |
calmap.calendarplot(events['# Killed'], yearascending=False, monthticks=3, daylabels='MTWTFSS', | |
dayticks=[0, 2, 4, 6], cmap='Reds', | |
fillcolor='grey', linewidth=0, | |
fig_kws=dict(figsize=(40, 40))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment