Analysis of Hygiene of The Restaurant in Manhattan

Analysis of Hygiene of The Restaurant in Manhattan

Posted by Shuheng Li

Updated: Jul 25, 2016


The food quality issue is getting more and more important; can how we eat healthier in a second? We do it with data. With the data analysis and visualization, we are more than ever capable of precisely finding the right way to a good restaurant.

Data Preparation

  • Dataset

The dataset DOHMH New York City Restaurant Inspection Results released by New York City Department of Health and Mental Hygiene, containing the results of restaurant inspections that are conducted once a year. The whole data set contains 450781 historical inspection records of 24765 restaurants. Every year, each restaurant is assigned a score and grade according to that score, which reflects the health and hygiene of that restaurant.

  • Data Preparation

Sample of dataset

The following features of the original dataset were picked up to draw a picture of New York City’s restaurant sanitation, and the two main tricks were played onto the dataset: the data of grading was converted into time format for getting the latest grade and the street, building, and borough were combined and then used to fetch geographical coordinates of each restaurant, with an R package named 'Rgooglemaps'.


  • Latest Restaurant Grades


Pretty good! This bar plot indicates that most of the restaurant are graded as A for all boroughs. Since 75% restaurants are graded A, and it seems that we are quite safe when having dinner in New York City.

  • Overall Sanitation Condition of Restaurants

History means a lot. We are definitely unwilling to have dinner at a restaurant that was once infamous. To fully analyze the overall sanitation of restaurants, the historical records should be taken into consideration, and here comes the result.


By applying the grading rules of DOHMH, the overall score was used to add a new variable called overall grade into the original dataset, supporting the analysis of grade change.

The scatterplot shows the distribution of different groups of the restaurants. There are many blue and green dots which represent A and B restaurants, and the green army occupies a huge area, which means that most restaurants have an issue on food security in the past, so there are so many restaurants graded as A but has a B overall grade.

The following are three heatmaps that drilldown the analysis on a group level , based on their overall sanitary conditions.


The center of A restaurants is located nearby Times Square and extends to cover the upper east side of Manhattan and the Columbia University area.


For B group, the center obviously moves toward the southwest. There are two high-density areas of B restaurants located on the upper east and Greenwich, which means the upper east Manhattan has more B restaurant.


The C group heatmap is greatly different from the previous two. The center is further south and there is a separate group that covers northwest Manhattan.

From three heatmaps above we can draw two conclusions:  that we’d better go midtown to north if we are seeking a great restaurant, even though that area is basically full of restaurants from every group; and people in Harlem are suffering from food sanitary problems.

  • Restaurant Sanitation Change

Indeed, while the distribution matters so do changes in grades. The scatterplot below was generated based on a comparison between “overall grade” and latest grade from each restaurant. This captures the trend of how restaurants’ sanitation condition changes over time. Overall grade was then compared to most recent grade.


The red dots indicate the restaurant grade is getting worse, while the green means improvement. We can see that most all restaurants remain the same grade over time, but almost all restaurants whose grade changed are getting worse, what a pity!


  • For Restaurants Owner

As the boss of a restaurant, you should think twice before every business decision. With the result of this analysis, the runner of a restaurant can also take the grade into consideration. For example, if the owner is running a restaurant in Harlem, the grade would not trouble him or her, due to the average poor sanitation condition.   The restaurant owner could save the money rather than trying to improve his grade.

  • For Us

Want to have a healthy dinner? Look at the map before looking at the menu.

Shuheng Li

With the intention of becoming a great Data Scientist, Shuheng is an out-box thinker and self-motivator who focuses on Machine Learning and Statistics, and seeks for challenging projects and competitions that push his skills to an advanced level....

View all articles

Topics from this blog: Data Science News and Sharing

Interested in becoming a Data Scientist?

Answer 3 Simple Questions and Get Immediate Course Recommendations.