Data Visualizing New York City's Parking Violation

Posted on May 1, 2016
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
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 data on 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
    • Open 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

Data Visualizing New York City's Parking Violation

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.

Data Visualizing New York City's Parking Violation

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.

Dates for Ticket Issuances

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

Data Visualizing New York City's Parking Violation

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.

Top 20 Streets for Ticket Issuances

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