Gun Violence In America

Posted on Jul 30, 2018

The skills the authors demonstrated here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.


Gun control is a politically divisive topic with people committed to strong opinions on the matter. But what does the data tell us?  I decided to take a look myself using the following Kaggle dataset:

The dataset itself is a database of individual incidents, complete with the date and location of the incident, the number of people involved, and the relationship between the suspects and victims.  A full analysis of all the information contained in the dataset would surely produce valuable insights, though it would be a massive undertaking beyond the scope of the project. Consequently, I decided to narrow my focus on only the time and space dimensions.  Furthermore, because the data contains incidents for the years 2013 through 2018, but the data for 2013 is sparse and 2018 is incomplete, I decided to omit those years from the analysis.

Across Time

To visualize gun violence over time, I created calendar plots with heat map shading that indicates the severity of deaths per capita (as measured by the number of deaths per 1m residents) and the number of incidents.  The most striking result is the sheer ubiquity of gun violence in America; in the 4 years from 2014 - 2017, there were only 4 days on which there were no incidents, with the average number of incidents per day at around 100:

Of course, the violence is not spread evenly across the country; some states are plagued by more gun violence than others.  For example, despite having half the population of California, Florida has roughly the same number of incidents per year:

Perhaps the city with the worst problem with gun violence is Chicago, and the despite the fact that Illinois has a third of the population of California, it has a substantially higher number of incidents:

Chicago is home to Illinois's Congressional District 7, which is most affected by gun violence; disturbingly it has a similar number of daily incidents as the entire state of Pennsylvania:

In terms of the number of deaths per capita, the states with the worst problems with gun violence are Arizona, Nevada, Alabama, and California:

Across Geography

Because the dataset included the congressional district in which each incident occurred, I wanted to see what, if any, relationship gun violence had with party affiliation.  Below are maps of the continental United States for each year where congressional districts are colored by party (Blue for Democrat, Red for Republican, and Green for DC), and the shade of the color is proportional to the severity of gun violence as measured by the number of deaths per capita:

While the maps don't change very much from year to year (and it is thus difficult to glean insight from their progression), it is interesting to note that some of the congressional districts with the most severe gun violence are also heavily gerrymandered.  One possible explanation for this could be that gun violence is more common among lower socioeconomic classes with higher proportions of minorities, which tend to vote Democratic, and that the relevant congressional district borders were drawn to minimize representation of this demographic.


This analysis was only a cursory first look at a dataset that is rich with information and could potentially provide valuable insight to help better understand the causes, effects, and potential solutions to a very real - and very serious - problem facing our country.

About Author

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI