What really affects bikeshare use in Vancouver?

City staff recently reported to Council about the status of the Mobi bikeshare system. You can see the slideshow for yourself here. Results generally look positive for the future of bikeshare in Vancouver, but a comment one slide stuck out for me: “Temperature influences ridership more than precipitation”.

Is this really true? In my experience, biking on a cool, dry day is much more enjoyable than biking on a warm rainy day. There was no clue in the council report on how they came to this conclusion, but I suspect they used the eyeball test. But the cooler months in Vancouver are also the rainy months, so a more careful analysis is needed. I’d recently seen an example in Jake Vanderplas’ Python Data Science Handbook¬†that looked at the factors influencing bike ridership in Seattle, so I decided to do a similar thing for Vancouver.

Continue reading “What really affects bikeshare use in Vancouver?”

Mobi station activity

I finally got around to learning how to map data on to maps with Cartopy, so here’s some quick maps of Mobi bikeshare station activity.

First, an animation of station activity during a random summer day. The red-blue spectrum represents whether more bikes were taken or returned at a given station, and the brightness represents total station activity during each hour. I could take the time resolution lower than an hour, but I doubt the data is very meaningful at that level.

 

Continue reading “Mobi station activity”

Machine learning with Vancouver bike share data

Six months ago I came across¬†Jake VanderPlas’ blog post examining Seattle bike commuting habits through bike trip data. I wanted to try to recreate it for Vancouver, but the city doesn’t publish detailed bike trip data, just monthly numbers. For plan B, I looked into Mobi bike share data. But still no published data! Luckily, Mobi does publish an API with the number of bike at each station. It doesn’t give trip information, but it’s a start.

Continue reading “Machine learning with Vancouver bike share data”

Datetime axis formatting with Pandas and matplotlib

Panda’s Dataframe.plot() function is handy, but sometimes I run up against edge cases and spend too much time trying to fix them.

On one case recently, I wanted to overlay a line plot on top of a bar plot. Easy, right? Not when your dataframe has a datetime axis. The bar plot and and line plot functions format the x-axis date labels differently, and cause chaos when you try to use them on the same axes. None of the usual tick label formatting methods got me back anything useable.

Continue reading “Datetime axis formatting with Pandas and matplotlib”

Matplotlib on the web

I’ve been learning a lot of Matplotlib recently at work and through a course I took on data visualization. I’ve especially had fun with making interactive plots, and I was curious about whether MPL code could be converted into HTML5 and/or javascript for presentation on the web. I’m a researcher, not a developer, so my main goal was to use the datavis library I already know without having to learn a bunch of javascript.

In my googling, I’ve found a few solutions to this issue. None are perfect for what I was hoping to do (have Django and MPL work together to produce a nice interactive figure) but I did come across some interesting tools.

Continue reading “Matplotlib on the web”