Data Study on Licensed Dogs in New York City

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

The Data

All dog owners in New York City are required by law to license their dogs. Through NYC Open Data, the Department of Mental Health and Hygiene provides aย data setย of active Dog Licenses from 2016 to 2017. This data set provides 14 features on 122K observations of registered dogs. Some features include:

  • User-provided dog name (unless specified otherwise)
  • Animal gender
  • Month and year dog was born
  • Dog breed
  • Owner Borough
  • Owner zip code

Data Analysis

I represented this data set with a interactive geographic visualization that shows the density of dogs per zip code. This was achieved by using a leaflet widget to represent zip codes as polygons on a map of New York running on a Shiny app.

The polygons accompanied with census data was retrieved from NYC Open Data in the form of a shape file. The color of the polygons represent the relative population density of the dogs in that zip code, light yellow being the least densely populated zip codes and dark red being the most densely populated.ย The widget allows for the user to interact with the map by clicking on the zip codes to receive information about that area population of dogs. For each zip code, it shows the total number of dogs, the population, the most common breed, and the most common dog name.


Data Study on Licensed Dogs in New York City

From the heat map style representation the user can quickly tell approximately how densely populated each of New Yorkโ€™s zip code is with dogs. The map also shows the population density of dogs per capita. This changes the distribution of colors to be more uniform as most zip codes have about average dogs per capita, while some zip codes with a smaller population size over have a relatively high number of dogs. Notice Battery Park and the Financial District in darker colors below:

Frequency of Dogs

Data Study on Licensed Dogs in New York City

The same information of the previous two maps can also be presented in a histogram where each bar is the frequency of dogs for each zip code colored by borough and the dark points represent the number of dogs per capita (100K people).

Data Study on Licensed Dogs in New York City

The web app also allows the user to select a breed to represent a population density map relative to a particular breed. A word cloud will also be generated with the most frequent names for that breed. Yet another area of the web app involves statistical information on the diversity of breeds by borough. See the top ten dog breed for Brooklyn below.

Specific Breeds


With the data provided, I was able to run a simulation to find the zip codes with the most under registered dogs for their population size. I ran a sample simulation the same size as the number of registered dogs in the data set relative to a probability distribution derived from each zip codeโ€™s population size. Iterating this sample simulation ten thousand times produced an expected value for the population of dogs in each zip code and the Shiny app was able to represent this information graphically.ย 

The zip codes with a larger number of registered dogs than the expected value are represented in light yellow, while the zip codes with far fewer registered dogs than the expected value are in dark red. You can tell that Brooklyn, Queens and the Bronx likely have higher density of unregistered dogs than Manhattan and Staten Island.ย I am confident this statistical method could be used by NYC Department of Mental Health and Hygiene to find which zip codes are the least likely to register their dogs.

About Author

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