Each time this happened to me, it got me thinking that there should be a way to forecast the demand in order to improve the supply. Fortunately, the guys at CityBikes have provided an API with the momentary availability of bikes. So, I scraped a several days worth of data, averaged the bikes per station and produced the following image.
The white dots are the stations that are on average (almost) full and the reds are (again almost) always empty.
Great, but this doesn't help at all with the forecast, because even though the station which is closest to my apartment is in yellow (meaning that on average there are bikes), it is always empty in the morning and always full at night. The obvious solution would be to average the bikes on each station by time of the day and then create an animation with that. And I did. Here's the result:
So here are few patterns that can be observed:
- The stations around Plaça Canalunya and Las Ramlas get packed after 7:00 and empty after 21:00 h.
- Raval is generally well supplied with bikes, except between 7:00 and 13:00
- Sant Gervasi, Eixample Esquerra and Eixample Dreta are chronically left without bicycles.
- In Sant Marti, the area on the right from Marina and around Poblenou, (which is famous for both lots of start-ups offices and night clubs) has bikes except between 16:00 and 21:00.
- And finally, the area around Navas and Clot empties around 8:00 and fills around 18:00. That's why I can never find a bike in the morning, and can never return one at night.
At this level of aggregation of the data, the patterns are not very clear and look rather chaotic. If the Ayuntamiento de Barcelona is willing to make the public bicycles' data public, it won't be too hard to create a visual tracing of the traffic patterns like this one from The Guardian. That will allow one to construct a predictive model that will inform the bicing servicing trucks where and when bikes are needed.
If you liked the post, or even if you did not like it - let me know in the comments below.
If you want to try it yourself, here's my R code: