{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "In this post, we will visualize the Paris Vélib bicycle stations using pandas and then, to do interactive exploration, `bokeh`. The goal is to get familiar with the plotting syntax of `bokeh`, which is quite different from `matplotlib`, the classic plotting package in the Python scientific stack." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Fetching the data " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "JC Decaux, the company responsible for the Paris shared biking system Vélib, has an open-data service available here: [https://developer.jcdecaux.com/#/opendata/vls?page=static](https://developer.jcdecaux.com/#/opendata/vls?page=static). We can use it to fetch the static data describing the different stations." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "df = pd.read_json(\"https://developer.jcdecaux.com/rest/vls/stations/Paris.json\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's look at the head of the data:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | address | \n", "latitude | \n", "longitude | \n", "name | \n", "number | \n", "
---|---|---|---|---|---|
0 | \n", "RUE DES CHAMPEAUX (PRES DE LA GARE ROUTIERE) -... | \n", "48.864528 | \n", "2.416171 | \n", "31705 - CHAMPEAUX (BAGNOLET) | \n", "31705 | \n", "
1 | \n", "52 RUE D'ENGHIEN / ANGLE RUE DU FAUBOURG POISS... | \n", "48.872420 | \n", "2.348395 | \n", "10042 - POISSONNIÈRE - ENGHIEN | \n", "10042 | \n", "
2 | \n", "74 BOULEVARD DES BATIGNOLLES - 75008 PARIS | \n", "48.882149 | \n", "2.319860 | \n", "08020 - METRO ROME | \n", "8020 | \n", "
3 | \n", "37 RUE CASANOVA - 75001 PARIS | \n", "48.868217 | \n", "2.330494 | \n", "01022 - RUE DE LA PAIX | \n", "1022 | \n", "
4 | \n", "139 AVENUE JEAN LOLIVE / MAIL CHARLES DE GAULL... | \n", "48.893269 | \n", "2.412716 | \n", "35014 - DE GAULLE (PANTIN) | \n", "35014 | \n", "
\n", " | address | \n", "latitude | \n", "longitude | \n", "name | \n", "number | \n", "postcode | \n", "
---|---|---|---|---|---|---|
0 | \n", "RUE DES CHAMPEAUX (PRES DE LA GARE ROUTIERE) -... | \n", "48.864528 | \n", "2.416171 | \n", "31705 - CHAMPEAUX (BAGNOLET) | \n", "31705 | \n", "93170 | \n", "
1 | \n", "52 RUE D'ENGHIEN / ANGLE RUE DU FAUBOURG POISS... | \n", "48.872420 | \n", "2.348395 | \n", "10042 - POISSONNIÈRE - ENGHIEN | \n", "10042 | \n", "75010 | \n", "
2 | \n", "74 BOULEVARD DES BATIGNOLLES - 75008 PARIS | \n", "48.882149 | \n", "2.319860 | \n", "08020 - METRO ROME | \n", "8020 | \n", "75008 | \n", "
3 | \n", "37 RUE CASANOVA - 75001 PARIS | \n", "48.868217 | \n", "2.330494 | \n", "01022 - RUE DE LA PAIX | \n", "1022 | \n", "75001 | \n", "
4 | \n", "139 AVENUE JEAN LOLIVE / MAIL CHARLES DE GAULL... | \n", "48.893269 | \n", "2.412716 | \n", "35014 - DE GAULLE (PANTIN) | \n", "35014 | \n", "93500 | \n", "
\n", " | latitude | \n", "longitude | \n", "number | \n", "
---|---|---|---|
postcode | \n", "\n", " | \n", " | \n", " |
75001 | \n", "48.862984 | \n", "2.339561 | \n", "1021.384615 | \n", "
75002 | \n", "48.868225 | \n", "2.342684 | \n", "2026.416667 | \n", "
75003 | \n", "48.862940 | \n", "2.359657 | \n", "3013.733333 | \n", "
75004 | \n", "48.855631 | \n", "2.356978 | \n", "4030.791667 | \n", "
75005 | \n", "48.845414 | \n", "2.348918 | \n", "5029.631579 | \n", "
\n", " | latitude | \n", "longitude | \n", "number | \n", "
---|---|---|---|
count | \n", "51.000000 | \n", "51.000000 | \n", "51.000000 | \n", "
mean | \n", "48.856930 | \n", "2.350670 | \n", "23765.439084 | \n", "
std | \n", "0.029586 | \n", "0.062251 | \n", "13170.681267 | \n", "
min | \n", "48.808535 | \n", "2.222189 | \n", "1021.384615 | \n", "
25% | \n", "48.832531 | \n", "2.309834 | \n", "13470.615741 | \n", "
50% | \n", "48.856693 | \n", "2.348918 | \n", "21703.833333 | \n", "
75% | \n", "48.881089 | \n", "2.399400 | \n", "33554.500000 | \n", "
max | \n", "48.909302 | \n", "2.474920 | \n", "44101.500000 | \n", "
<Bokeh Notebook handle for In[20]>
<Bokeh Notebook handle for In[21]>
<Bokeh Notebook handle for In[27]>
<Bokeh Notebook handle for In[28]>