Data Analysis on Department of Consumer Affairs Charges

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

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.


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.

Data Analysis on Department of Consumer Affairs Charges


Data Analysis on Department of Consumer Affairs Charges


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.  Then, 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.

Data Analysis on Department of Consumer Affairs ChargesThe 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

#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