Using Python to Understand A Bike Share

On a trip to Seattle last week, I noticed the city is just about to launch their new bike sharing program – Pronto. Since moving to LA, I have come to appreciate both biking and efficient transportation. After deciding I’d become a member for when I visit, I came back to a basic question.

For an annual membership where unlimited 30 minute rides are included, just how many stations can I ride between for “free” without incurring an extra $2 fee for taking more than 30 minutes?

Being a nerd, I decided that Python and the Google Maps API could help me answer the question.

The Pronto network is launching with 50 stations. Based on the triangular number there are this many paths between bike stations.


Since there are 50 nodes in the network, then:

50(50 − 1)/2 = 1225

Therefore, I want to know the average travel time between those 1225 stations. If, for example, I live in a neighborhood with a station close by, just how many other stations can I get to within 30 minutes?

Since I am a big fan of being lazy, and also assume stations will be added over time, I decided to script (more like poorly hack) out a set of scripts in Python to do this for me. I noticed the Pronto website gives all locations in a JSON call and decided to feed this data into the Google Maps Directions API.

The result?

  • 846 routes take less than 26 minutes and are safely “free” with a membership
  • 164 routes take between 26 and 30 minutes and have a risk of costing $2 with a membership
  • 215 routes rake more than 30 minutes and will likely always cost $2 or more with a membership

I am a big fan of sharing data and work.