Today in Data: NYC Restaurant Inspections

New York City, like an increasing number of American metropolises, boasts a decently impressive Open Data web site. A lot of the tables are out of date or otherwise useless, but some of them are pretty cool and are updated fairly often.

Tonight, as a hobby while allowing my digestive system to process copious amounts of turkey, stuffing, and chocolate cheesecake, I downloaded the restaurant inspection data table, which contains over half a million records of inspections within the city over the past several years.

I began by whittling down the dataset to include only inspections that took place this year. Then I removed all inspections that didn’t have a borough field filled out (Bronx, Manhattan, Queens, Brooklyn, or Staten Island), as well as removing all rows with anything other than A, B, or C in the field for letter grade. Finally, I filtered out all but the most recent inspection for each establishment — so if a particular diner, for example, was inspected more times due to its uncleanliness (this is official policy), I only included the last one.

This left a final count of 22,105 restaurant inspections in 2014 alone — only the last one conducted for each establishment, and only for inspections resulting in a letter grade of A, B, or C and associated with one of the five boroughs.

First, I checked to see whether any discrepancies existed among the letter grades awarded to restaurants in the various boroughs:

Here’s the same chart in percentage format:

Interestingly, where I began to see a divergence was when I checked grades by month, rather than by borough:

In the winter months (January through March), as well as so far this November, A grades constituted over 90% of all final inspections. From April to October, however, that ratio hovered anywhere from just under 83% to just under 90%. Of course, I don’t have the December numbers for this year yet (time travel has yet to be invented — unless, of course, it’s already happened in the future), but I’d assume it would follow the same general trend: fewer A grades in the summer, more in the winter.

To delve further into this hypothesis, I filtered out all A grades and sorted the remaining 2,648 Bs and Cs by their most common violation descriptions. Here are the top 10:

The top violation is storing food at temperatures that are too high, something that would occur most frequently in the summer months. And indeed, 272 of the 406 total counts of this violation (67%) took place in the four-month period from June to September 2014, for a monthly average of 68 counts. By contrast, from January through May, restaurants were only cited for this violation on a total of 94 occasions, or fewer than 19 times per month.

Indeed, of the five top violations reported in inspections resulting in B and C grades, four involve either overly-hot food or (the potential for) infestation by rodents, flies, and so forth — in other words, classic summer problems.

One final thing you might not expect: the cleanest bill of health given to a specific type of cuisine was for…donut shops. So you’ll know where to find me in the next few weeks:

That’s it for now. Feel free to send me more ideas for how to parse this data, and I may continue this series with other datasets as well.

Post Revisions:

About Jay Pinho

Jay is a data journalist and political junkie. He currently writes about domestic politics, foreign affairs, and journalism and continues to make painstakingly slow progress in amateur photography. He would very much like you to check out SCOTUSMap.com and SCOTUSSearch.com if you have the chance.

What do you think?