July 18, 2014
Mapping NYC Hydrant Revenue: Upper East’s 19th Precinct is Ridiculously Ticket Happy

After discovering the highest grossing hydrants in NYC, as measured by ticket revenue, I decided to expand a bit and make a map of the top 250 offending hydrants using the same NYC Open Data dataset.

At the top of the list, of course, are the two sneaky hydrants that were recently exposed by this blog.  But mapping the remaining ones shows they are anything but evenly distributed around the city:

The map allows you to see the estimated annual ticket revenue from each of the top 250 grossing hydrants.  Hover over any hydrant to see the revenue. The larger the circle, the more revenue generated.  (Click on any hydrant to see the address.  ”O” means opposite, and “F” means in front of.)

After looking at this for a bit, what stood out the most to me was Lenox Hill on the Upper East Side.  The number of top hydrants in that neighborhood seemed unreal.  In fact 25% of the hydrants on this top 250 list are in that single neighborhood around the 19th precinct. 

So is the 19th Precinct really that much of an outlier in the city?  I decided to look at all hydrant tickets in the data set, and a more startling fact came to light: The 19th precinct issues an estimated 3 million dollars a year in hydrant tickets, more than double the total of the next closest precinct: the 34th in Washington Heights and Inwood, which issues about 1.4 million dollars in hydrant tickets annually.  This graph shows how extreme the 19th Precinct is, when compared to the other Top 10 Precincts for Hydrant Tickets: 


So if you live in Lenox Hill and drive, make sure you cary measuring tape! And good luck. 

Data provided by NYC Open Data (August 1st 2013 - March 26th 2014)
Interactice Map made in CartoDB
Hydrant analysis done with pandas/ipython
Geocoding done with Google via geopy

July 14, 2014
Mapping Duane Reade: A Look at NYC’s Drugstore Turf War

Duane Reade.  There are few things more New York than those two words strung together.  They seem ubiquitous, and yet there are times when you somehow find yourself closer to a non Duane Reade pharmacy than a Duane Reade pharmacy.  How could this be?  And how common is this unreal situation?  Luckily for us, a bit of data can solve this mystery.

But before turning to the numbers, I’ll admit that its refreshing to see non-chain pharmacies surviving (and in some cases thriving) across the city. Nevertheless, most New Yorkers end up using one of the four biggest chains in the city: CVS, Duane Reade, Rite Aid or Walgreens.  And for that reason, today’s post focuses on those four pharmacy giants. 

So how does one decide what pharmacy to use?  Chances are, it is not ardent brand loyalty.  More often than not, most people choose the closest pharmacy to their home.  As New Yorkers, we walk everywhere, so proximity often becomes everything.  

In light of these proximity effects, the success of a NYC pharmacy is based heavily on strategically locating the store.  In the maps that follow, I color coded every single lot in NYC to match which of the four major pharmacy chains is closest. 

To get us started, here is a map of the Southern half of Manhattan, with parts of Brooklyn and Queens: 

Southern Manhattanphoto test1_zps2c273b64.jpg

The map shows what New Yorkers already know: that Duane Reade dominates Manhattan.  But there is some territory left for the other three there.  Presumably they moved into some of those locations along the water strategically since Duane Reads  are concentrated more in the center of the island.

Zooming out a bit we get a better sense of Duane Reade’s prominence in most of  Manhattan:

Manhattan/Queensphoto test1_zps7638ccde.jpg

However, once we leave Manhattan, the story changes quite drastically. The Bronx seems to be dominated by Rite Aid.

The Bronxphoto test1_zps6019a302.jpg

Brooklyn and Queens don’t seem to have any particular winner.  They are what I would call a patchwork of pharmacy turf. 

Queensphoto test1_zps5782fbca.jpg

Brooklynphoto test1_zps6e4e71ab.jpg

Staten Island is the only borough where CVS seems to dominate and where Walgreens has a significant market share. 

Staten Island:

photo test1_zps8eeed91a.jpg

And zooming out we can see the entire city:

NYC:photo test1_zps1cfac35c.jpg

Lastly, if we take the total number of lots in each Borough, and count how many are closest to each pharmacy, we can get a very rough measurement  of the dominance of each brand in each borough:

Market Share per Borough, by Lot


The measure is crude because it gives equal weight to all lots, regardless of the number of people residing on them.  So it is not a measure of the number of people closest to each pharmacy. And of course lots in Manhattan are much denser.  Even so, the overall winner by this lot counting metric?  Rite Aid!  Who knew?  This apparently made Walgreens pretty jealous, and so they went ahead and bought Duane Reade.  The table above shows why this decision made a ton of sense.

So I guess Duane Reade is not the most New York thing after all.  It is just the most Manhattan thing. And there is no telling what the future will hold, but one thing is for sure: it will involve more pharmacies.

Data used in this post: 

Google Places API

Tools used: 
QGIS, Excel

(Note that Google Places API will have some noise in it, so there may be some errors in the map.) 

Filed under: pharmacy opendata 
July 11, 2014
Williamsburg Leads NYC in Weekend Late Night Taxi Complaints

Anyone who has been in NYC for a long time has inevitably had an argument with a cab driver.  Sometimes they won’t take you where you want to go.   Sometimes they refuse to accept credit card.   And when things escalate, sometimes you call 311. 

Luckily for us, those calls give us some data to explore.  I downloaded 2013 taxi complaint and compliment data from NYC’s 311 Data and had a look.

The data showed 15,947 taxi driver complaints in 2013, or about 43 complaints a day.  That means the the average cab gets about one complaint every 3 months, but those could be spread between 2-3 drivers. Not shockingly, complaints are more common than compliments:

but 5% of such calls are indeed compliments!  That is almost 3 compliments a day, or about one compliment for every 3 million New Yorkers!

We can also explore what time of day and day of week people complain the most:


The chart shows that 4PM is when complaints peak; this is also shift change time, so that may be partially to blame.  Very often taxi drivers won’t take you where you want to go unless it’s on their way home.  

Also note the late night weekend complaints shown in the upper left and right corners of the table.  They are elevated through 5AM.

When did people complain the least? Christmas, when there were only 6 complaints.  Second least? Thanksgiving, coming in at 18.

Complaints are filed all over the city, but they are most dense in Manhattan below 96th St, and at JFK and Laguardia:


The map also shows elevated levels around Atlantic Yards, and Cobble Hill. 

As noted, there are elevated levels of complaints on weekend nights past midnight. What if we only look at late night weekend complaints on a map?


The map shows that late night weekend complaints are concentrated in neighborhoods like the Lower East Side and Greenwich Village.  The problem with this map is that it will be affected by density… more people means more complaints.  

To control for that, I took all zip-codes with at least 30 complaints.  I then looked at the % of complaints that happen between the hours of midnight and 4AM on weekends. The results are charted below:


The area with the highest ratio of evening complaints?  Williamsburg, where 20% of all taxi complaints happen after midnight on Saturday and Sunday AM.  

The rest of the list looks familiar to anyone who has gone out in NYC:


Note that the leading zip codes for taxi complaints seem to map closely with the late night Citibike ridership I explored a couple months back.   

Once taxi trip data become more open, we will be able to test the percentage of all rides that involve complaints and see if that changes at night or during holidays.  But for now, don’t forget to compliment your drivers on 311!  That will make you one in a million.. I mean three million!

Data Used: 311 Data and ZipCode Shapes
Tools Used: Excel, QGIS

Filed under: opendata nyc 311 taxi nightlife tlc 
July 7, 2014
I Quant NY is Largest Referrer to NYC Open Data Site for June

I was excited by all the great press the blog got last month.  Thanks to that, and data-minded readers like you, I Quant NY was able to send more people to the NYC Open Data Portal than any other website in June (other than NYC itself and of course Google!)  Exciting stuff!  

Here is the list pulled off of NYC Open Data’s Analytics Site for June, 2014: 


So we have a long way to go to pass Google.  But either way, thanks to all who continue to share the work.  Much more stuff to come.  Stay tuned, and hope you had a Happy 4th.

Filed under: iquantny NYCOpenData opendata nyc 
July 3, 2014
Best Places To Watch Illegal Fireworks? Let’s Ask 311

First, a public safety announcement:  Don’t set off fireworks in NYC.  It’s illegal and you can get hurt and arrested and…well, just don’t do it.  

Now that I said that, I have to admit that I have seen an occasional amateur firework go off in the city, and it can be quite fun to watch. So let’s just say if you miss the big show on the river on the 4th of July, and you were wondering when and where is the best place to see people do stupid things, 311 has got you covered.

I looked at over 900 firework complaints to 311 since 2010 to find where these pesky things were going off.

So, presenting the Illegal Fireworks Map of NYC:image

The findings?  Inwood (10034) takes the cake with 36 complaints. Bensonhurst and Bath Beach come up next (11214).  The next 3 are Washington Heights (10032), Bulls Head in Staten Island (10314) and Gravesend in Brooklyn (11223).

So that tells you the where.  But what about the when?

Not surprisingly, the number of daily complaints peaks historically on the 4th of July, so that’s a good bet: 


Interestingly, there are 5 times more firework complaints in June than August, revealing that people have bought their 4th of July Fireworks and just can’t wait until the big day.  By July 6th, things have quieted down quite a bit.

So your best bet?  4th of July in Inwood.  

Happy July 4th everyone!

(Note that I realize that this is just a proxy for firework activity, as it is complaints, and not the actual setting of fireworks.) 

Filed under: 311 fireworks nyc opendata NYPD 
Liked posts on Tumblr: More liked posts »