Skip to content

Instantly share code, notes, and snippets.

@fasiha
Last active May 24, 2022 00:04
Show Gist options
  • Save fasiha/0cdb636cd3cb1bf4d3a637079901f1f0 to your computer and use it in GitHub Desktop.
Save fasiha/0cdb636cd3cb1bf4d3a637079901f1f0 to your computer and use it in GitHub Desktop.
CDC Wonder
import pylab as plt
plt.style.use('ggplot')
plt.ion()
import pandas as pd
df = pd.read_csv("wonder.tsv", sep="\t", index_col=0)
ret = (df[["homicide", "motor", "suicide"]].div(df.total, axis=0) *
100e3).plot(grid=True, marker='.')
plt.title('New York State, Asian deaths per 100,000')
ret.lines[1].set_linestyle("--")
ret.lines[2].set_linestyle("-.")
ret.lines[2].set_marker("x")
plt.legend()
ret2 = (df[["motor", "suicide"]].div(df.homicide, axis=0)).plot(grid=True,
marker='.')
ret2.lines[1].set_linestyle("--")
ret2.lines[1].set_marker("x")
ret2.lines[0].set_label('motor vechiles per homicide')
ret2.lines[1].set_label('suicide per homicide')
plt.legend()
plt.title('New York State, Asian, deaths per homicide (CDC)')
plt.axhline(y=1, color='k', linestyle='-')
year homicide total motor suicide
1999 22 1122472 48 59
2000 33 1157977 48 40
2001 124 1213384 55 41
2002 32 1255048 50 51
2003 24 1293519 53 54
2004 23 1327853 59 61
2005 23 1362726 52 74
2006 20 1398778 61 63
2007 15 1439779 67 72
2008 20 1485783 53 69
2009 24 1529520 50 68
2010 17 1561960 58 78
2011 20 1599823 63 92
2012 13 1650175 55 92
2013 20 1697670 59 100
2014 21 1767565 57 100
2015 15 1826093 51 98
2016 18 1844346 52 91
2017 20 1902407 52 99
2018 12 1846015 49 100
2019 22 1850616 61 124
2020 10 1881911 54 107
@fasiha
Copy link
Author

fasiha commented May 23, 2022

nys-asian

@fasiha
Copy link
Author

fasiha commented May 24, 2022

nys-asian1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment