Visualizing New York City's Parking Violation Data

Steven Ginzberg
Posted on May 1, 2016

Contributed by Steven Ginsberg.He is currently in the NYC Data Science Academy 12 week full time Data Science Bootcamp program taking place between April 11th to July 1st, 2016. This post is based on his first class project - R visualization, due on the 2nd week of the program.


For my first R development project, I set out to visualize the Parking Violations issued in New York City during 2016. My goal was to find patterns in parking ticket issuances and find the perfect parking spot. Of course, past performance is no indicator of future performance, so be warned!

NYC open data initiative has a great deal of data for the city. Parking Violations Issuances for FY 2016 can be downloaded from the website HERE.

Loading the Data

Once downloaded, the data was easy to import, though time consuming (1.4gb, 7.3 million records). Working with a large dataset, regardless of the software, can cause problems during the development cycle. For instance, if I joined tables incorrectly, I often ran out of memory. Once debugged, the data loads smoothly in a reasonable amount of memory.
The primary data file includes ticket issuances for the 2016 NYC fiscal year, or July 2015 thru June 2016, or a partial year. Unfortunately, the actual data included tickets issued from January 2015 thru December 2016. Further investigation is required to identify the exact cause of the the problem. Other data problems included missing and incorrect fields, inconsistencies in the addresses. I have made the assumption that the dates entered are typos, and are meant to fall within the fiscal year.

Cleaning and Supplementing the Data

The code can be found HERE.

To clean and supplement the data, the code performs the following data manipulations:

    • Load the main file, 'Parking_Violations_Issued_-_Fiscal_Year_2016.csv'
    • Load the definitions for the violation code
    • Load Precinct/Borough/coordinates data
    • clean up some of the field names
    • join the tables
    • finally, I remove some temporary variables

After these steps are finished, we have 7.3 million records with 64 fields.

Visualizing the Results

One of the distinctions with R and ggplot that I am about to get familiar with in a hurry is the difference between discrete and continuous data. This database has no continuous fields, which limits the types of plots available.  The code can be viewed HERE.

First, I took a look at the issuances across the boroughs


Not surprisingly, Manhattan has the most number of issuances, and encompasses about 1/2 of the database The remaining visuals show to Manhattan only (sorry BBQS). I created a variable to switch between Manhattan only and the whole city (on PVI Graphs.R lines 24-25). However, the scale of all the charts are set for the Manhattan only data.
Next I took a look at the types of violations.

Parking Violations by Violation Type

There are about 100 type codes, so the chart takes a look at the top 10 (again, Manhattan only). These account for 75% of all issuances. The violation codes table has a long text string describing each violation, sometimes referring back to the law section. In order to fit the text and make this more descriptive, I supplemented the original table with my own short version of the description. The original code is shown so a user can refer back to the full text.

The third chart is a look at the top 10 dates that tickets were issued.


While these 10 days only account for 10% of the tickets, they are up to 10 times the daily average (represented by the dots, at 2,500 tickets). Also, all but one are in July, 2015. I tried and failed to find any news that would explain this. Given the results are right at the change of the fiscal year, it leads to questions about the quality of the data.

Finally, I charted the top 20 streets on which the tickets were issued.


While this is an interesting view, it didn't go as far as I'd like. Broadway wins the prize, but it is also the longest street in the city, and it would be nice to know where on Broadway the tickets were issued. Unfortunately, I was unable to find latitude/longitude information to identify specific hot spots. I was able to attach latitude/longitude coordinates to the police precincts, as highlighted in chart 5. This chart is a jitter-plot, but since everything is centered around the precinct, rather than the actual street location, it's not helpful.


About Author

Steven Ginzberg

Steven Ginzberg

Steven has spent a number of years performing systems development, financial analysis and management in a variety of companies. Most recently, Steven has been working with start-ups helping them go from conception of ideas, identifying technologies, and finally...
View all posts by Steven Ginzberg >

Related Articles

Leave a Comment

Pablo May 31, 2016
After study a few of the blog posts on your own website now, and I really like your way of blogging. I bookmarked it to my bookmark site list and will be checking back shortly. Pls check out my website too and allow me to know what you believe.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws 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 Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R 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 Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp