NYC Data Science Academy| Blog
Bootcamps
Lifetime Job Support Available Financing Available
Bootcamps
Data Science with Machine Learning Flagship 🏆 Data Analytics Bootcamp Artificial Intelligence Bootcamp New Release 🎉
Free Lesson
Intro to Data Science New Release 🎉
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook Graduate Outcomes Must See 🔥
Alumni
Success Stories Testimonials Alumni Directory Alumni Exclusive Study Program
Courses
View Bundled Courses
Financing Available
Bootcamp Prep Popular 🔥 Data Science Mastery Data Science Launchpad with Python View AI Courses Generative AI for Everyone New 🎉 Generative AI for Finance New 🎉 Generative AI for Marketing New 🎉
Bundle Up
Learn More and Save More
Combination of data science courses.
View Data Science Courses
Beginner
Introductory Python
Intermediate
Data Science Python: Data Analysis and Visualization Popular 🔥 Data Science R: Data Analysis and Visualization
Advanced
Data Science Python: Machine Learning Popular 🔥 Data Science R: Machine Learning Designing and Implementing Production MLOps New 🎉 Natural Language Processing for Production (NLP) New 🎉
Find Inspiration
Get Course Recommendation Must Try 💎 An Ultimate Guide to Become a Data Scientist
For Companies
For Companies
Corporate Offerings Hiring Partners Candidate Portfolio Hire Our Graduates
Students Work
Students Work
All Posts Capstone Data Visualization Machine Learning Python Projects R Projects
Tutorials
About
About
About Us Accreditation Contact Us Join Us FAQ Webinars Subscription An Ultimate Guide to
Become a Data Scientist
    Login
NYC Data Science Acedemy
Bootcamps
Courses
Students Work
About
Bootcamps
Bootcamps
Data Science with Machine Learning Flagship
Data Analytics Bootcamp
Artificial Intelligence Bootcamp New Release 🎉
Free Lessons
Intro to Data Science New Release 🎉
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook
Graduate Outcomes Must See 🔥
Alumni
Success Stories
Testimonials
Alumni Directory
Alumni Exclusive Study Program
Courses
Bundles
financing available
View All Bundles
Bootcamp Prep
Data Science Mastery
Data Science Launchpad with Python NEW!
View AI Courses
Generative AI for Everyone
Generative AI for Finance
Generative AI for Marketing
View Data Science Courses
View All Professional Development Courses
Beginner
Introductory Python
Intermediate
Python: Data Analysis and Visualization
R: Data Analysis and Visualization
Advanced
Python: Machine Learning
R: Machine Learning
Designing and Implementing Production MLOps
Natural Language Processing for Production (NLP)
For Companies
Corporate Offerings
Hiring Partners
Candidate Portfolio
Hire Our Graduates
Students Work
All Posts
Capstone
Data Visualization
Machine Learning
Python Projects
R Projects
About
Accreditation
About Us
Contact Us
Join Us
FAQ
Webinars
Subscription
An Ultimate Guide to Become a Data Scientist
Tutorials
Data Analytics
  • Learn Pandas
  • Learn NumPy
  • Learn SciPy
  • Learn Matplotlib
Machine Learning
  • Boosting
  • Random Forest
  • Linear Regression
  • Decision Tree
  • PCA
Interview by Companies
  • JPMC
  • Google
  • Facebook
Artificial Intelligence
  • Learn Generative AI
  • Learn ChatGPT-3.5
  • Learn ChatGPT-4
  • Learn Google Bard
Coding
  • Learn Python
  • Learn SQL
  • Learn MySQL
  • Learn NoSQL
  • Learn PySpark
  • Learn PyTorch
Interview Questions
  • Python Hard
  • R Easy
  • R Hard
  • SQL Easy
  • SQL Hard
  • Python Easy
Data Science Blog > R Visualization > Data Analysis on Vehicular Collisions within NYC

Data Analysis on Vehicular Collisions within NYC

Regan Yee
Posted on Oct 23, 2016
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

Introduction

New York City — data shows it's known for its fast walkers, busy people, and of course aggressive drivers. Many people who live here know that it is a nightmare to drive here; there are too many cars, too few parking spots, jaywalkers, cyclists, flashing lights, honking, and the list goes on. It's no wonder that after living here for a majority of my life that traffic conditions in Boston felt very tame in comparison.

When I was in Boston for college, the local Bostonians would say that their driving experience there was horrible. Some of my Indian coworkers would compare Boston's traffic with India's traffic while others coworkers who have visited New York would say New York is more like India. So just how crazy are New York City's drivers?

Data Analysis on Vehicular Collisions within NYC

Is New York City as bad as this?

Data Background

To explore that question, I looked at it from the perspective of vehicular collisions. I wanted to find out the where, when, and why vehicular collisions were occurring:

  • Where are most of the collisions occurring? Where are the main pain points in NYC?
  • When are the collisions occurring — do we see any trends with the time by hour of day and by month?
  • Why are the collisions occurring? We want to take a look at the top reasons why New Yorkers get into car crashes.

I used NYPD's Motor Vehicular Collisions dataset which is provided by the NYC Open Data repository. This dataset is built for the Vision Zero initiative. Vision Zero is a program that started in 2014 and is intended to halve the number of traffic fatalities by 2025. The dataset has about 900k rows with 30 observations ranging from July 2012 to YTD 2016. The dataset is updated every weekday; the batch of data I used was to 10/11/2016. After finding the purpose of the dataset, the last question and elephant in the room is:

  • Is Vision Zero working so far? That is, have we been seeing a decreasing trend for fatalities within NYC?

Data Current State of NYC

To get a general sense of the current state of NYC's vehicular collisions, I made a choropleth representing the YTD vehicular collisions in NYC. Since the data comes as individual records of collision incidents, I had to slice up the date column to extract the year. Then, after aggregating the data by year and zip code, I used the choroplethrZip library to create a map of NYC for 2016 YTD collisions:

Data Analysis on Vehicular Collisions within NYC

Visually inspecting this choropleth, we can see that the main pain points in NYC are:

  1. Heavy traffic density/population neighborhoods and hip neighborhoods like:
    1. Midtown (not surprisingly!)
    2. DUMBO
    3. Long Island City
  2. Poor neighborhoods:
    1. East New York and Canarsie area

These observations were in line with what I expected; neighborhoods with many people and cars as well as less wealthy neighborhoods with bad infrastructure are expected to be pain points. But when, and why are these areas pain points? First, to understand when these collisions are occurring, I wanted to look at the collisions by hour of day. Before doing any analysis, I expected the morning rush to be the most dangerous as people are tired and groggy while going to work.

Data Analysis on Vehicular Collisions within NYC

Looks fun in the morning doesn't it?

Time

To analyze this, I stripped the hour from the time field of each collision incident and then aggregated the data by hour and count of incidents. A ggplot with a geom_bar worked perfectly for this visualization:

crashes_by_hour

It turns out that while the morning rush starting at 8AM does start the day's collisions, most of the collisions happen around 4-5PM — quitting time for a majority of people. One explanation to this is that more people are awake during these hours (people who don't follow the traditional 9 to 5) compounded by the annoyed workers trying to get home ASAP. I performed a similar analysis by month to see if certain months are worse than others, but there was no apparent trend.

Contributing Factors

To explore the last facet of NYC's collisions, I turned to the contributing factors for the collisions. If the majority of these collisions are happening due to a certain set of reasons, countermeasures can be implemented to prevent them. First, I aggregated the count of contributing factors for the entire dataset:

Number Reason Count
1 Unspecified 500826
2 Driver Inattention/Distraction 106757
3 Fatigued/Drowsy 48153
4 Failure to Yield Right-of-Way 36776
5 Other Vehicular 27953

It turns out that a majority of these collisions are not actually crazy or aggressive drivers, but actually tired and distracted drivers. It may be possible that New Yorkers, who are notoriously stuck in a 'busy' culture, are too tired and overworked. I took this set of data and filtered on reasons for fatal collisions:

Number Reason Count
1 Unspecified 536
2 Traffic Control Disregarded 124
3 Driver Inattention/Distraction 95
4 Failure to Yield Right-of-Way 75
5 Passenger Distraction 52

With this data in mind, the Vision Zero program should be able to implement countermeasures address these pain points. Has the situation improved over the years?

Batter Up: Vision Zero's Data

2013-2014

To explore that question, I created 2 choropleths with a diverging colormap to represent the diffs in collisions for the years of 2013-2014 and 2014-2015. I only used these years because these were the only years where we had a full years worth of data.

2013-2014 2014-2015

As we can see, 2013-2014 looks good — we see a generally blue (decreasing) trend. However, the total population of collisions increased slightly in that period, going from 203,689 collisions in 2013 to 205,929 collisions in 2014 (a 1.10% increase). While there are still some pain points, many areas do seem to generally be improving, which is good for NY.

2014-2015

The next map, representing 2014-2015, is concerning though, as all of NYC looks like it's in the red. This is particularly concerning as this is the year when Vision Zero was kicked off. The total count of collisions increased somewhat drastically in this period relative to last year, going from 205,929 in 2014 to 217,539 in 2015 (a 5.64% increase).

I speculated on the reasons for this increase and thought that it may be possible that Vision Zero put more emphasis on collecting better collision data. As a result, collision data is more meticulously captured and hence an increase in the number of collisions. It's also possible that inevitably, an increasing number of people in NYC may account for an increasing number of collisions. Objectively looking at the numbers, one may presume that Vision Zero has been failing since its implementation.

However, if you think about the mission statement for Vision Zero — which is to reduce fatalities — then Vision Zero may be working in that regard. I aggregated the data by fatal accidents by year and saw a decreasing trend:

Year Count of Fatalities
2013 297
2014 262
2015 243

NYC may be becoming more densely populated and may inevitably have more crashes (due to human error), but at least those crashes can be less tragic . Using this set of data, I wanted to see where most of the reductions in fatalities came from.

Fatalities by Borough

To do this, I looked at the fatalities and grouped the data by borough over the same 2 year period. Here we can see some interesting trends forming from these graphs.

fatalities_by_borough

Wow! The trends per borough seem all over the place — Manhattan and Queens have seen some decreases in fatalities, but Brooklyn has been stagnant at 67 for the 3 years, Staten Island has actually been increasing, and the Bronx has somewhat of an erratic trend. This chart seems to indicate that there are limited resources in the Vision Zero program and certain areas are getting more benefits while others are having a blind eye turned on them. Since this program is still young, this may be useful in guiding the decisions for reallocating resources to certain areas.

Conclusion and Next Steps

Although vehicular collisions have been increasing over the past couple of years, the number of fatalities has been decreasing. If we look at the mission statement for Vision Zero, then in that regard the program is currently working. However, it appears that only certain areas have benefitted from the Vision Zero and more work and resources need to be allocated to address some problem areas.

Since this is an actively updating data set, I would definitely be interested to see if future data points continues this trend of certain boroughs benefitting more. I would also want to see if the areas that are being neglected are correlated to areas which are poor and have bad infrastructure. Finally, I would want to create a KPI report/dashboard comparing NYC's implementation of Vision Zero vs. other cities implementing a Vision Zero program. Using that, I would want to see if New York's stats are normal for metropolitan areas.

About Author

Regan Yee

Regan is an aspiring data scientist who comes from a computer science background. He obtained his Bachelors degree from Northeastern University in Computer Science. After graduating, Regan worked at State Street Global Advisors on business intelligence systems, performing...
View all posts by Regan Yee >

Leave a Comment

Cancel reply

You must be logged in to post a comment.

No comments found.

View Posts by Categories

All Posts 2399 posts
AI 7 posts
AI Agent 2 posts
AI-based hotel recommendation 1 posts
AIForGood 1 posts
Alumni 60 posts
Animated Maps 1 posts
APIs 41 posts
Artificial Intelligence 2 posts
Artificial Intelligence 2 posts
AWS 13 posts
Banking 1 posts
Big Data 50 posts
Branch Analysis 1 posts
Capstone 206 posts
Career Education 7 posts
CLIP 1 posts
Community 72 posts
Congestion Zone 1 posts
Content Recommendation 1 posts
Cosine SImilarity 1 posts
Data Analysis 5 posts
Data Engineering 1 posts
Data Engineering 3 posts
Data Science 7 posts
Data Science News and Sharing 73 posts
Data Visualization 324 posts
Events 5 posts
Featured 37 posts
Function calling 1 posts
FutureTech 1 posts
Generative AI 5 posts
Hadoop 13 posts
Image Classification 1 posts
Innovation 2 posts
Kmeans Cluster 1 posts
LLM 6 posts
Machine Learning 364 posts
Marketing 1 posts
Meetup 144 posts
MLOPs 1 posts
Model Deployment 1 posts
Nagamas69 1 posts
NLP 1 posts
OpenAI 5 posts
OpenNYC Data 1 posts
pySpark 1 posts
Python 16 posts
Python 458 posts
Python data analysis 4 posts
Python Shiny 2 posts
R 404 posts
R Data Analysis 1 posts
R Shiny 560 posts
R Visualization 445 posts
RAG 1 posts
RoBERTa 1 posts
semantic rearch 2 posts
Spark 17 posts
SQL 1 posts
Streamlit 2 posts
Student Works 1687 posts
Tableau 12 posts
TensorFlow 3 posts
Traffic 1 posts
User Preference Modeling 1 posts
Vector database 2 posts
Web Scraping 483 posts
wukong138 1 posts

Our Recent Popular Posts

AI 4 AI: ChatGPT Unifies My Blog Posts
by Vinod Chugani
Dec 18, 2022
Meet Your Machine Learning Mentors: Kyle Gallatin
by Vivian Zhang
Nov 4, 2020
NICU Admissions and CCHD: Predicting Based on Data Analysis
by Paul Lee, Aron Berke, Bee Kim, Bettina Meier and Ira Villar
Jan 7, 2020

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 ChatGPT 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 football 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 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

NYC Data Science Academy

NYC Data Science Academy teaches data science, trains companies and their employees to better profit from data, excels at big data project consulting, and connects trained Data Scientists to our industry.

NYC Data Science Academy is licensed by New York State Education Department.

Get detailed curriculum information about our
amazing bootcamp!

Please enter a valid email address
Sign up completed. Thank you!

Offerings

  • HOME
  • DATA SCIENCE BOOTCAMP
  • ONLINE DATA SCIENCE BOOTCAMP
  • Professional Development Courses
  • CORPORATE OFFERINGS
  • HIRING PARTNERS
  • About

  • About Us
  • Alumni
  • Blog
  • FAQ
  • Contact Us
  • Refund Policy
  • Join Us
  • SOCIAL MEDIA

    © 2025 NYC Data Science Academy
    All rights reserved. | Site Map
    Privacy Policy | Terms of Service
    Bootcamp Application