David G. Khachatrian

Prompted by recent public incidents in the United States, I began to wonder what sort of data were available regarding gun policy and related statistics across different countries. I ended up coming across the Gun Policy website and saw that they performed the Herculean task of collating statistics from numerous sources into “one-page” fact sheets. Using these pages as a source of truth, I scraped the webpages1, did some cleanup on the results, and created some visualizations of how gun homicide rates and civilian firearm possession rates have evolved over time2. The web scraper (built mainly with scrapy) and visualization (done mainly with geopandas, geopy, and plotly) are hosted on my GitHub.

The visualizations can be viewed here (using nbviewer) – but sadly, it seems interactivity is limited to non-mobile devices3. A slightly dirty Notebook that has interactive plots with animation buttons (which mobile users can press to view the different snapshots) can be found here. I have also locally hosted copies of the animated versions of the gun homicide rate and civilian firearm ownership rate over time.

Hopefully there are fewer tragedies that prompt these sorts of inquiries.

  1. As mentioned on their About page, people are free to use any information on the site as long as the source is properly attributed. 

  2. I had been curious in performing some more rigorous/quantitative analysis, but the data coverage (not surprisingly) varies a good deal from country to country. 

  3. Sadly, interactive functionality on mobile devices seems to be missing in many of the Python plotting libraries…