Tag Archives: open data

Today in Data: A Month in the Life of CitiBike #18068

CitiBike has proven to be quite the hit in New York. As of mid-November, CitiBike claimed that riders had taken 14,589,242 trips since the service launched in May 2013. With approximately 330 docking stations and 6,000 bikes in circulation, that’s a lot of wear and tear on each bike.

In the spirit of finding out just how much of a workout these bikes get, I pulled the latest full month of available bike trip logs from CitiBike’s site, which happens to be August 2014. I sorted by bike ID to determine which specific bike was ridden the most times that month.

This led me to CitiBike #18068, a stalwart two-wheeler with 349 individual trips taken in August — over 11 rides per day. (5,958 unique bikes were ridden a total of 963,489 times in August, for an average of 162 trips per bike.) Using the GeoJSON geographic data convention, I was able to map all of these trips by plotting the starting and ending bike stations on Google Maps:

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.