Data Visualization on Crimes in New York City

Posted on Feb 5, 2018
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

Background & Purpose

Just 20 years ago, data shows the streets of New York were racked with all kinds of crime, from murders, drug deals, to grand larceny, petite thefts. Since the late 90s, the city has seen an encouraging trend in steadily-declining crime rates. However, it goes without saying that even today, public safety is one of the top concerns of the city’s more than eight million residents, as well as for the hundreds of thousands of new comers or visitors annually who do not know the city's neighborhoods as well as the locals do.

So I aim to provide an intuitive and easy to use crime data visualization tool built from the extensive police report database, which is available on the NYC Opendata website.

The Data

Currently, the dataset contains close to six million crime records collected from a period of more than 10 years. New data is being added annually. For illustration purpose and practical reasons I decided to take a random subset of 100,000 observations from the dataset, which is more in line with the scope of this project.

Overview

Without further a due, let me introduce the actual functionalities of my app. First, we have the overview tab, which contains five sub-tabs: Crime by Type, Crime by Month, Crime by Hour, Crime by Borough and Crime by Premises. Each of these tabs are structured in a very similar fashion: users can choose to browse through yearly data using the filter on the top and the bar chart below will display the total crime counts by each group/category.

These bar charts are designed to give users very basic and yet solid understanding of the crime distributions in NYC. Sometimes trends can be spotted more easily on charts as simple as these! For example, if we take a look at Crime by Month:

Data Visualization on Crimes in New York City

Turns out when the weather is cold during winter/early spring months, criminals take a break too. Summer times usually observe higher crime counts.

Data Visualization on Crimes in New York City

Surprise surprise, residential crimes make up about 40% of all crimes in the city. Your home may not be as safe as you thought it was!

Interactive map

The interactive map is a great function for users who are after every bit of details on crimes the happened in the city in the last ten years. They can filter through crime types, premises and time periods to focus on a subset of the data they are interested in. also Users can use the "Cluster" options to group nearby crimes in order to avoid making the map too crowded. After zooming in, users can also click on each individual crime spot to get more detailed info on the crime. The optional "Point" layer may help user select individual crime records more easily.

Heatmap Data

Similar to the main interactive map, users of the heatmap can also use the filters on the panel to focus on a subset of the data they are most interested in. But unlike the interactive map, the heatmap won't plot all the instances of crime from the database, but rather show the users the density of crime occurrences across different neighborhoods in NYC. This function gives the users greater flexibility and a clearer view on the big picture.

Crime Rates for the Five Boroughs Data

Next I decided to do some visualizations on crime rates for the past 10 years across the five boroughs. Users can select which boroughs to plot though the filters on top. And once the data is fed into the plotly chart, users can temporarily select or deselect by clicking on the legends for easier comparisons. By looking at crime rates data for Manhattan, Brooklyn and Queens, some may be surprise that Manhattan’s crime rate is comparable to Bronx, both substantially higher than Queens and Brooklyn. This is why data visualization is important, it may correct some of your long time misconceptions.

Thanks for watching, please feel free to browse my Shiny App and Github via following links!

Link to Shiny App

Link to my Github

Email: [email protected]

About Author

Yinan Jiang

Yinan recieved his Bachelor's Degree in Accounting from Shanghai University of Finance & Economics and Master's Degree in Economics from USC. Before data science, he worked both as an Equity Analyst and Data Analyst for major financial institutions...
View all posts by Yinan Jiang >

Related Articles

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