Department of Consumer Affairs Charges

Posted on Feb 4, 2018

The Charges Data Set

The NYC Open Data project provides the Department of Consumer Affairs data from 2016-2017.  The Department of Consumer Affairs was started in 1969 with the goal to "ensure compliance with local consumer protection and licensing laws, and State and federal regulations."  They oversee almost every industry in NYC.  This data set describes the charges brought against NYC businesses and through analysis, can reflect how the enforcement plays out in practical terms.

It contains 50, 000 rows, which includes location data, some categorical information such as borough and business category, but not too much numerical information.  This project had to rely heavily upon count of charges for the visualizations.  A lot of time was spent on parsing through the Charge descriptions which were challenging to categorize.

Here's a sample of what the Charge descriptions looked like:


"NYC Admin Code § 20-708 - STORE DID NOT CONSPICUOUSLY DISPLAY THE TOTAL SELLING PRICE, AT POINT OF DISPLAY, FOR ITEM."                                                              

"6 RCNY § 5-70(a) - NO PRICE LIST FOR SERVICES DISPLAYED"                                           

"6 RCNY § 5-70(a) - PRICE LIST NOT DISPLAYED CONSPICUOUSLY"                                           

I parsed the first part which describes the rule and is before the dash of the description, then counted the number of charges vs each categorical description.  I would have liked to generalize about what each rule was, and turn this into a category as well.  However, I realized that would skew the analysis since for some categories, it's difficult to conclude what the general description might be.  I also tried to find a source about the rules which I could then cross reference, but only found this searchable document which is difficult to scrape data from.

Who are the stakeholders and what can we learn?

Are you an activist citizen who is concerned about what regulations your local businesses are required to follow?  Or perhaps a policy maker who is interested in the applicability of the current laws and rules that protect consumers?  Would it be surprising to discover that most of the charges fall under just a few categories?  That industries such as pharmacies and tobacco retailers get enforced more heavily?  Or that more charges were brought against boroughs which have stronger retail business climates?  In analyzing the data, I discovered these kinds of trends.



The App

More insights can be garnered by visiting the app and manipulating the parameters.  I chose a very simple design and intended that the parameters could be applied to multiple plot types which can then be viewed by navigating through the tabs.  I left it in the user's control to decide how many "top" industries or charge types they were interested in analyzing.

I also provided a word cloud to highlight what the most dominant words in the text of the charge descriptions.  I used some R packages to remove the extraneous English words and additionally, I removed words like "near", "required" and "upon" which don't relay any meaning.

The Code

And now without further ado, please feel free to peruse my code.

About Author


Zipporah Polinsky-Nagel

Zipporah is pivoting to data science from her creative and energetic experience as a 15-year veteran at an international Financial Technology company. Zipporah's experience there involved: developing the trade cash flow generation and API, project managing, and leading...
View all posts by Zipporah Polinsky-Nagel >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

2019 airbnb alumni Alumni Interview Alumni Spotlight alumni story Alumnus API artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Big Data bootcamp Bootcamp Prep Bundles California Cancer Research capstone Career citibike clustering Coding Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Industry Experts Job JP Morgan Chase Kaggle lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Open Data painter pandas Portfolio Development prediction Programming PwC python 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 recommendation recommendation system regression Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Tableau Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping What to expect word cloud word2vec XGBoost yelp