Jupyter Notebooks (formerly called IPython notebooks) are a way of combining code; text and images into an interactive document. They are ideal for doing geospatial analysis of census data using the Python programming language. In this simple example the GeoPandas Python library is used to read in a shapefile of 2011 Middle Layer Super Output Areas (MSOAs) for Leeds and generate a choropleth map of the number of households present in each MSOA area.

An image of a python notebook reading in and displaying geographic data

If you want to play with this notebook yourself, clicking Go to Notebooks below will spin up a jupyter notebooks instance hosted on mybinder.org

Go to notebooks [opens in new window]

It can take some time, up to 5 minutes, for mybinder.org to create the jupyter notebook environment, during which you will see a page that looks like this:

An image displaying binder starting up

Once the jupyter notebook environment is ready you will see a list of Jupyter Notebooks like this:

An image showing the landing page of a jupyter notebook

Click on one of the notebook links e.g. make_a_choropleth.ipynb to view the notebook.

A Jupyter Notebook consists of a series of cells. Each cell can contain chunks of code or text. In this case, the cells contain chunks of Python code.

To run all the cells, from the menubar select Cell >> Run All

You can edit the code in any of the cells and then re-run that cell to see the changes that this makes. For example, the cmap='Oranges' parameter in this cell sets which style of color ramp is used to shade the choropleth map.

An image showing a cell in a jupyter notebook with code for plotting geographic data in an orange colour scheme

Try changing this from 'Oranges' to 'Reds'. Then re-run all the cells again.