← Blog archive

Open Data · March 18, 2014

FOILing NYC's Taxi Trip Data

4551294863_c7c97580b4_b

Update 6/16/2014:  Many people have asked for this data since I published this post, and like a non -forward-thinking government, I've come up with a lot of excuses for not sharing it.  Here's a couple of torrents.  Happy hacking!

2013 Trip Data (11.0GB)

2013 Fare Data (7.7GB)

Update 6/18/2014: Andrés Monroy graciously offered to host these files for download, and has setup a simple download page with smaller chunks of the data.  Social Media connections FTW!

FOIL (The Freedom of Information Law) is like the computer-illiterate grandmother of Open Data.  The first time I came face-to-face with FOILed information, it was in the form of a phonebook-sized set of printed charts indicating the flow rates of Combined Sewer Overflows (Check out Leif Percifeld’s dontflush.me project).  Whoever he foiled wasted a ton of paper on it, and scraping data from the charts was an actual proposed activity at an eco-themed hackathon. I had heard plenty about people’s awful experiences with FOIL, lots of unresponsive or uncooperative government agencies, months-long backlogs, and everyone’s favorite, lots and lots of PDFs (PDFs are where data goes to die)!  A relative of mine (we like to hold our governments accountable in my family) even told me a State government responded to her FOIL request saying it would cost them $20,000 to fulfill it, and if she cut them a check they'd happily oblige.  I had never really been through the process first-hand, but last week, NYC’s Taxi and Limousine Commission tweeted a data-driven chart that caught my eye:

taxi1

#metricmonday they call it, a twitter campaign that involves some visualization made with taxi data.  This time around it was a chart showing hourly taxi volume in a given week, highlighting the twice-daily dip in available cabs during shift change.  Like any good chart, it sourced it’s data: “NYC TLC 2013 taxi tripsheet data”

My immediate response from the BetaNYC twitter account was “Is the data available?”… I knew it wasn’t, but wanted to see what they'd say.  I had seen this trip data manifested in several data animations, and had even seen a presentation on it by NYU Center for Urban Science and Progress Researchers (ironically, in a class about the possibilities of Open Data).  Search high and low, you won’t find this data available for download anywhere.

Taxi! from Juan Francisco Saldarriaga on Vimeo.

The TLC’s twitter account responded quickly, stating that the data was easily FOILable, providing a link, which I followed.  Several civic hackers responded, expressing concern over the unavailability of the data.

Twitter___nyctaxi__It_s__metricmonday_again__...-2

To my surprise, they accepted requests via email.  All you had to do was fill out a PDF form.  Well, it seemed like a good day to make my first FOIL request, so I used Apple Preview to paperlessly fill out and sign the request form, and fired it off via email.

foil_form_doc.pdf

Also to my surprise, I received a response only a few hours later:

Search_results_-_chris.m.whong_gmail.com_-_Gmail

You’re not only required to provide a large enough hard drive, but it must be “brand new, still in the box and unopened”, presumably for security reasons. This requirement is a bit silly in my opinion, and probably prevents a lot of would-be FOILers from getting this data, but I made it this far so I figured I’d keep going.

Search_results_-_chris.m.whong_gmail.com_-_Gmail

I grabbed a 500GB Drive from Radio Shack and made plans to drop it off at the TLC’s offices in lower Manhattan.     On the 22nd floor of 33 Beaver street, I was courteously greeted by the same person who emailed me.  I handed off the drive, and made arrangements to pick it up early the following morning.

So that’s it… I retrieved the drive and saw that all of the data they loaded only took up about 50GB.  Overall, I have to say I was impressed with the TLC’s responsiveness, professionalism,  and the fact that they allow email correspondence for this sort of thing in the first place.  Despite the annoyance of two in-person trips and the expense of a brand new hard drive, I was able to go from viewing the FOIL information page to possessing the data in just 2 business days.  (Not bad for what it is, but it doesn’t change the fact that this data should be open, API accessible, downloadable, and free for all to use.  Size and complexity of the data are not an acceptable excuse in 2014)

Enough with the FOILing, let’s check out the data!  Here’s a few screengrabs so you can get a feel for what’s included.  I still haven’t figured out what exactly I’m going to do with it, but you can bet it will be animated and beautiful.

FOIL__20203

There are two folders of data, Faredata_2013 and Tripdata_2013.  Each folder contains chunks of data in csv format, ranging from ~1.5 to ~2.5 GB in size.

Screenshot_3_18_14_11_14_PM

Fare data looks like this, showing medallion, hack_license, vendor_id, pickup date/time, payment type, fare, tip amount (look at all those zeros!), tolls, and total.

trip_data_1.csv_—_chistat.demo.socrata.com

Trip data (the good stuff!) looks like this.  Each file has about 14 million rows, and each row contains medallion, hack license, vendor id, rate code, store and forward flag, pickup date/time dropoff date/time, passenger count, trip time in seconds, trip distance, and latitude/longitude coordinates for the pickup and dropoff locations.  The possibilities are endless!  I smell a tip analysis coming on!

I'll be brainstorming with civic hackers at this week's BetaNYC hacknight about how/where we can host the data for others to use.  Some ideas have already been proposed over on our Facebook Group.

Thanks for reading!  I hope you enjoyed this, and that NYC's Taxi trip data will be Open Data before too long.

Cover Photo by flickr user moonman82

This post was migrated from my old WordPress blog. Embedded maps and links to third-party sites may no longer work.

Comments (archived, closed)

  1. Eric Fischer ·

    I'll be happy to make room on trafficways.org for anyone who wants it to download it. Please drop me a line. Seems like the kind of thing archive.org would be happy to take on too.

  2. Bolei Zhou ·

    Hi Chris,

    I am Bolei, graduate student in MIT specializing on data mining. Recently I am developing a trajectory clustering algorithm and would like to evaluate it on the NYC taxi trip data. I am wondering whether I could directly download the NYC taxi trip data from you?

    Thanks!

    1. Chris ·

      Hi Bolei,

      Unfortunately I have not had a free moment since obtaining this data to look at it, let along get it uploaded for sharing. I hope this will change soon and will post an update when there's something to share. (I've shared it in person at the BetaNYC civic hacknight, but have not had time to upload it anywhere yet)

  3. AB ·

    Give'em hell, Quimby! :-)

  4. Bolei Zhou ·

    thanks. I foiled the data by myself. I got 2012 and 2013 NYC taxi trips. Thanks for the guide of this post!

  5. Shea Lutton ·

    Is the tip amount $0.00 because people are cheap or is it because drivers are taxed on their cash tips and self report the amount? Often times waiters in restaurants receive zero tips because then Uncle Sam gets a tip too.

  6. Saul ·

    Let's bittorrent this!

    1. Chris ·

      Done. Links to torrents in the main post.

  7. Peter Smit ·

    +1 for bittorrent!

    1. Chris ·

      Done. Links to torrents in the main post.

  8. Alex ·

    BitTorrent would be the perfect way to distribute this data. Here's a short set of instructions if you haven't done it before: https://torrentfreak.com/how-to-create-a-torrent/

    1. Chris ·

      Done. Links in my post.

  9. Georgia Bullen ·

    Re: Tip Amounts

    I've worked with this data before in graduate school (I worked with Juan who made the vimeo video) and I noticed that the tips were usually $0 with the cash rides. I only looked at samples of the data, so it might've been the samples, but it also might be because they don't report cash tips, similar to restaurant workers.

    -GA

  10. Jess ·

    Hi Chris,
    Thank you so much for setting up the torrent! Can you tell me if this data set contains only info for yellow ("medallion") cabs? I'd love data from the green cabs, and 2013 is the right year for it...

    1. Chris ·

      These data are for yellow cabs only.

  11. Hi ·

    The files are mirrored to archive.org at https://archive.org/details/nycTaxiTripData2013 (click the "All Files: HTTPS" link or use the torrent to download them. Thanks for sharing!

    1. Chris ·

      Awesome! Does archive.org just make this page on its own, or did someone "tell it" to archive these files?

  12. William ·

    Do you know how far back their data goes? More importantly, do you know if they have green cab data available yet? I'd be willing to acquire the above and make it available, too, if it's possible...

    1. Chris ·

      No and yes... I don't know how far back it goes. I do know that they have green cab data but are not making it available yet. I would try FOILing it using the process I described here. I would tweet at the TLC... see what they say.

  13. Felipe Hoffa ·

    Jason Hall uploaded them to BigQuery.

    Dataset ready to be analyzed for free, instantly (once you create your account, you get a free monthly quota to do so).

    http://www.reddit.com/r/bigquery/comments/28ialf/173_million_2013_nyc_taxi_rides_shared_on_bigquery/

  14. Tom Swanson ·

    Thanks and congrats on getting this on torrent! Here's my python code I used to work with this data. https://github.com/tswanson/TaxiNYC2013 There was a lot of work to filter out junk and outlier data.

    Tip Amounts - only for credit card transactions. Presumably if someone paid by card and tipped in cash on top of that, that would not be recorded also. CRD

  15. Steve Jernigan ·

    Very nice work and thank you for making this easily available. I'm not sure if Uber got this data, analyzed it and kept it private, but if they didn't I'm pretty sure they are not an $18Bn. company. Also if I were the NYC TLC I'd probably lobby that Uber make their data open like this. They've basically improved their knowledge of customer flow by 170MM customer transactions. That's amazing to do in a few afternoons of work.

  16. Mike ·

    I would like to see data from the thousands of ride-sharing cars operating in NYC.
    If we collect such data from yellow taxicabs - why not ride-sharing cars that operate
    essentially in the same exact market ??

    I realize that ride-sharing are private and frequently offshore corporations but this is
    data on public transportation and should be collected and exposed, same as with
    yellow taxicabs.

  17. Sean ·

    If we identify each trip across both the fares and trips data sets would they match on a combination of Medallion and Pickup_DateTime?

  18. DKO ·

    FYI they have way more than one year worth of data; they handed a student from our research group data dating back to 2009. Time to fill out some more FOIL forms I guess? Or you could just have asked the guy you talked to if he could include more years. They have those CSV files already exported anyways.

  19. twikstik ·

    some slides and analytics for nyc data at : http://www.twikstik.com/blog/ and code + slides at : https://github.com/akuchlous/NYC_CAB_ANALYTICS

    interesting facts:
    most of the rides are less than 1 mile long
    most of the rides have 1 passenger !

  20. Julian Martens ·

    Hi,

    i have a server with gigabit full duplex (in europe). i want to support this project and would like to sponsor some links. Chris write me to my email(!). or should i post some links here as a comment? I think the links could be embedded on the main page.

    PS: I am downloading the whole package at this time but with a very low speed...

  21. Julian Martens ·

    Here we go :) hosted with seafile
    Have fun with this two nice links (!)

    tripData2013.zip
    http://46.189.116.100:8082/files/665f06c0/tripData2013.zip

    faredata2013.zip
    http://46.189.116.100:8082/files/41e34648/faredata2013.zip

  22. Julian Martens ·

    Hi me again.

    The access token is changing so here we go with the original links:

    tripData2013.zip
    http://46.189.116.100:5421/f/7808faae1f/

    faredata2013.zip
    http://46.189.116.100:5421/f/4128c6398d/

  23. Muhammad Aurangzeb Ahmad ·

    Thanks for releasing the data, here is our first take on the data. One of the most surprising result was the indirect indications of demographics of the city.

    http://www.aurumahmad.com/nyc-mta-taxi-some-observations-part-i/

  24. Nick Judd ·

    Chris, this is great stuff. Also, if this is precedent for the rest of the city to handle bulk data requests, I think it's a huge and welcome development.

    I have a long track record of being critical of government response to Freedom of Information Act requests generally and in New York City in particular. The city under Bloomberg was very often uncooperative or, in my opinion, hesitant to release as much data as it could under the law. As you say, the size of the dataset at issue was an often-used excuse. This is an example of how such an excuse is hard to justify.

    Here's why I'm so enthusiastic.

    You've pointed out a huge difference between what happens under FOIL and what happens under, for instance, the city's Open Data directive. If I recall the law correctly -- and it's been a while so I might not -- you're right that for the purposes of the Open Data directive, this information really ought to be available for public bulk download and API-accessible.

    However, as far as FOIL is concerned, this is great.

    FOIL and the Open Data law do two different things. The premise of FOIL is that in New York State it is the law of the land that any work product of any public agency or official, with a few clearly defined exceptions, is available for public access and review. What your family members told you about may be examples of ways that public officials plead technological ignorance or try to prey on time restraints or a lack of mastery of the law in order to avoid complying with their legal obligation. However, they may also be the complaints of overworked public servants who have no legal or technological framework for fulfilling their obligations, and bosses who are unwilling to help them do so. If it was easier for them to comply with the law, in other words, they'd be more likely to do it.

    What you describe here is an example of how public officials can comply with the law in a way that does not compromise their other obligations. It also seems like a good way to fulfill the spirit of the law. It's their obligation to release their work product, provided none of the FOIL exemptions apply. It's not their obligation to create new work product for you, and if they really do have to put in hours and hours of work or incur new expenses to fulfill your request, it's not very equitable to ask the rest of the city to pay just to satiate your curiosity.

    So, for the purpose of FOIL, "build an API every time" probably isn't reasonable, but "bring us a hard drive and we'll copy over our work product" seems like it might be a good start.

    There are some potential problems, though. For example, this means that the only people who can get a FOIL request fulfilled in this manner are able to afford a brand new hard drive. The data one gets this way may be in a proprietary format or otherwise unreadable, which would not be in the spirit of the law. And your hard drive might get stuck in city bureaucracy for weeks or be returned full of redacted material. However, FOIL has provisions to deal with that. I'm no lawyer, but I would argue that this kind of trick, if you encountered it, would constitute constructive denial of your request, and under FOIL you'd be entitled to appeal.

    All of this is wholly separate from the Open Data law, which is different in purpose and more in line with what you think cities should be doing with their data. I think of the Open Data law as letting governments release data they want to release, while FOIL is a way to prevent governments from keeping important things secret.

  25. blaincate ·

    heatmap for where the taxi pick up in NYC

  26. Rahul ·

    Hi Chris,

    Thank you for sharing the data. I was wondering about the coordinate system of this data set.

    Thanks once again.

  27. shady ·

    Why does torrent file not work?

  28. Hao ·

    Hi Chris, I am a research at Virginia Tech. I tried to download the NYC Taxi dataset with the .torrent files you published on this blog. However, the zip file of 2013 Trip Data (11.0GB) seems not properly zipped, and after I downloaded this file, it cannot be correctly unzipped. I am wondering do you still have the copy of the data? If yes, is there a way to get a copy of the data from you? Thank you very much.

  29. Hao ·

    Hi Chris, I tried to download the data mentioned in your blog with the .torrent files, but one of the files is not appropriate zipped and I could not retrieve all the data files from it. I am wondering if you still have the original data. If yes, is there a way I could get the data? Thanks.

  30. kimberly ·

    Do you happen to know who actually created this database? I'm trying to create a very large database full of fascinating information, but cannot find a developer. Any information would be super helpful! Thank you.

  31. Brett ·

    I am having the same problem as Hao - I downloaded these just fine but they won't unzip. "Error: central directory not found."
    Any help on how to fix this or pointing to another place to get the data would be greatly appreciated.

    Thanks.

    1. Chris ·
  32. Can Ozkan ·

    On the link that you have provided, trip data has some corrupted files. When I tried to download each month separately, months 3, 4, 5, 6, 7 were empty (https://ia902501.us.archive.org/zipview.php?zip=/1/items/nycTaxiTripData2013/tripData2013.zip). I also downloaded the torrent version, it has the same issue. Is it possible to provide the trip data for those months as well?

    Thanks!

  33. Bill Qin ·

    The bt link to tripData2013 seems dead. Could you share the data again?

  34. Iris ·

    I like this dataset very much and actually can see how long each taxi ride takes.
    I want to use this dataset for a school project. By any chance, do you have the data dictionaries of the attributes used in the two datasets? What are
    rate_code
    store_and_fwd_flag
    ?

  35. Varun ·

    Hey Chris - Thank you for exemplifying and inspiring openness. This was used for informing my research at NYU CUSP.

    1. Chris ·

      Honored! Let me know if you're still in NYC and would like to link up.

  36. Jay ·

    This is amazing. Thank you. Suggestion: Find strategies .... do cabbies tend to drive around or stay put or to head to a favorite waiting place? You can derive behavior and strategies from the geo data, and you can classify each shift by its drivers dominant strategy. Then you could look at how lucrative a given strategy is. An alternate approach to discovering strategies would be to watch your "day in the life" animation for the top- and bottom- earning cabs on any given day. You'll be able to SEE how they behave, and perhaps identify strategies that way.

  37. Two Wheels North ·

    I am in search of trip data for 2014? Has anyone requested and is it available online anywhere? Downloading would be a much faster option than FOIL request in the event that it is already available.

    1. Chris ·

      Full 2014 probably won't be available for a few months, but you should ask @nyctaxi on twitter and see what they say. I'll FOIL it someday.

  38. Céline ·

    Thank you very much for sharing these amazing data sets. I will be using them for my master thesis in economics. Do you however by any chance have the code books available? Some variables (rate_code / store_and_fwd_flag) remain to be unclear. Would be very helpful!

    1. Chris ·

      No, sorry... your best bet is to contact the TLC, they are usually very responsive about these things.

  39. Felica ·

    An outstanding share! I have just forewarded thius onto a friend who was doing a little research on this.
    And he in fact ordered me lunch due to the fadt that I found it for
    him... lol. So allow me to reword this.... Thank YOU for the meal!!
    But yeah, thanks for spending time to talk about this issue
    heree oon your web site.

  40. Mario Mario ·

    it is totally insane, now we have to tip cab drivers for doing their job? Paid 61.00 from downtown to Laguardia , 15, 3 miles, the tip section is already included into software if you want to pay with a credit card,, I know people's they work all day long for those money, work hard and they don't pretend tips for doing their job!!!!

  41. Hanna ·

    You mentioned that you observed a lot of zeros for tips but in your data visualization, A Day in the Life, you mentioned that the tips that were observed where only credit card transactions (no cash). Are you referring that cash tips weren't recorded? How do you know this? It is weird to me that the TLC didn't provide information on the statistics and only the raw data...

  42. Hanna ·

    Did TLC not provide any additional information on explaining the variables? All the zeros in the tips column could indicate that they were tipped with cash instead of using plastic...

    1. Chris ·

      The driver has no mechanism to report tips when the credit card machine is not used. I don't have a good source for this, you would need to ask the TLC

  43. Hanna ·

    So I contacted the TLC and this is what they had to say...

    "Vendor ID indicates which vendor the vehicle’s meter uses (either Creative Mobile Technologies or Verifone). Rate code indicates the type of fare the vehicle was engaged in. Rate code information can be accessed on the following page: http://www.nyc.gov/html/tlc/html/passenger/taxicab_rate.shtml. Store and forward flag indicates whether the trip record was held in vehicle memory before being sent to the vendor; this may occur when the vehicle did not have a connection to the server. A value Y means the trip was stored and forwarded, a value N means the trip was not stored and forwarded."

  44. Raghuvaran ·

    This dataset contains data for 1 year. I thought of doing time series forecasting with this data but i couldnt do as the data is for only 1 year. what are all things we can do with this dataset?

  45. Jeremy Wong ·

    TLC just made the dataset public. However, I noticed that the medallion ID and hack license variables are deleted. They also denied my request for the old format due to privacy concerns. So far I have the data for 2010-2013 in old format and 2009, 2014 in new format. Do you by any chance have the trip data for 2009 and 2014 in the original format? Thanks in advance.

  46. shanugavelessy ·

    Taxi service business is always a revenue generating and dependable business to start and starting a taxi service business is now on the check list of every business wolf and budding entrepreneur. Though requiring a good amount of capital a taxi business can repay you the principle in no time and triple your investment in less than one financial year. Maintaining a clean location, servicing your cabs every once in a while, hiring dependent and trust worthy personnel for your office as well as for driving purposes and setting up a GPS like system to always keep a track on your cabs are few factors that are sure to make a hole in your budget in the early stages. http://ondemandbay.com/taxi-script.php

  47. Tony ·

    Thank you for sharing the data. I notice the data on TLC's website does not have medallion ID and hack license. Do you by any chance have the trip data for years other than 2013 in old format? Thanks!

    1. Chris ·

      No, they removed it from all subsequent data releases, citing privacy concerns. The names and license numbers of all For Hire Vehicle drivers are already published openly, so I don't see the need to hide them in the trip data, but that's what they did.

  48. Rene ·

    Under which license are those Taxi Trip Data?

  49. George ·

    Hi, I have a silly question. In the 2013 data base, what does "medallion" and "hack_license" mean? Is hack_license unique for every driver?

  50. Phil ·

    The download links are not working http://www.andresmh.com/nyctaxitrips/ Could anyone fix them?

    Thanks!

  51. RainMachinezjo ·

    Europe, and in Ancient Russia