The course structure and some online resources for the UCL Business Management Dataviz module.

Due to the Covid disruption and to accommodate the majority of students in time-zones to the east of the UK, lectures/workshops will run from 10am to 1pm London/UK time. In order to reduce the intensity of a three hour online session, the workshop will be interspersed with mini challenges.

Timetable

1 (Friday 29 May) 10:00 - 13:00

Introduction to the Module, stating key learning aims, workshop structure and covering any tools that will be used (e.g. Python Jupyter notebooks)

Exploring data using Python notebooks.

Python notebooks have become to the goto environment for much data science and exploratory data visualization work. Here we’ll use one to explore some contemporary Corona Virus and Brexit datasets.

  • see Ch. 10 and 11 of “Data Visualization with Python and JavaScript” (DVPJ)

Using Plotly to generate web-friendly charts using Python notebooks

We will take some of the data charts and maps produced and see how easy it is to embed them in a web-page.

2 (Monday 1 June) 10:00 - 1300

Web-dev 101

Here we’ll learn enough web-development skills to be able to embed charts (HTML) (e.g. Plotly, D3, Leaflet), put them where we want them (CSS) and style them (CSS). We’ll also see a little JavaScript in action.

We will also look at Scaleable Vector Graphics (SVG), the markup language used (by D3 and others) to produce many of the iconic modern data visualizations.

  • see Ch. 4 “Data Visualization with Python and JavaScript” (DVPJ)

3 (Wednesday 3 June) 10:00 - 1300

Introducing D3

This workshop will introduce D3, the JavaScript dataviz powerhouse. We will cover basic D3 functionality such as working with selections, adding DOM elements etc. D3 is now a collection of powerful modules that can be used independently - we’ll see a few of the more commonly used ones in action.

  • see Ch. 16 DVPJ

4 (Friday 5 June) 10:00 - 1300

Putting D3 to working

We will see how to use D3 to construct a reasonably ambitious animated chart, based on the famous New York Times Wealth of Nations visualization. Key JavaScript dataviz idioms will be introduced in the process.

5 (Monday 8 June) 10:00 - 1300

An open session. This time will allow students to focus on any of the previous topics, discuss possible thesis visualizations etc. Students are encouraged to send questions and suggestions via email: k.dale@ucl.ac.uk

Installing Python Environment for Jupyter Notebooks

We will be using Python Jupyter notebooks for the exploratory dataviz. This will involve running a notebook locally and viewing it on your browser of choice. The installation instructions can be found here:

https://jupyter.org/install.html

JupyterLab is a newish, more full-featured notebook environment which gains functionality but does have a steeper learning curve. For the purpose of this module the older, simpler Jupyter notebooks are fine.

We will be using Python 3.5 (and newer versions) to run our notebooks. I recommend using a virtual environment to install the necessary libraries. If you’re using Anaconda (https://www.anaconda.com/products/individual) then this will be sorted for you. Otherwise you can use the venv Python library:

https://realpython.com/python-virtual-environments-a-primer/

If you don’t want to deal with virtual environments don’t worry - it should be fine to install these libraries globally. At the command line use Python’s pip to install the necessary libraries:

(ucl) ➜ pip install pandas matplotlib plotly seaborn jupyter

To test that the installation worked go to your work directory and start jupyter:

(ucl) ➜  ucl jupyter notebook
[I 14:07:31.642 NotebookApp] Writing notebook server cookie secret to /home/kyran/.local/share/jupyte
r/runtime/notebook_cookie_secret
[I 14:07:31.907 NotebookApp] Serving notebooks from local directory: /home/kyran/Dropbox/clients/ucl
[I 14:07:31.908 NotebookApp] The Jupyter Notebook is running at:
[I 14:07:31.908 NotebookApp] http://localhost:8888/?token=b94f61712fd471df42cee235c1182a04faa8cf74 ...

This should open up a browser window at address localhost:8888 (otherwise open a browser tab using the address and token provided) with a Jupyter notebook. Select File->New Notebook and paste the following into the first cell:

import pandas as pd
import matplotlib.pyplot as plt
import plotly
import seaborn as sns

Then run the cell using shift+return. If all goes well this will run error free and number the cell 1.

We’re now good to start the Python based exploratory dataviz.

You can find a test notebook (test_setup.ipynb) and pip requirements.txt at the Dropbox folder (https://www.dropbox.com/sh/92rpcc8e0ckbcv7/AACZftR5x5oME0WIMz64jk-4a?dl=0)

If you have any problems feel free to send me an email (k.dale@ucl.ac.uk) or, better yet, open a discussion in the forum so we can pool fixes.

Javascript resources

We’ll be using Codepen (https://codepen.io/collection/XGyvyO) for the majority of our web-dev and JavaScript learning. I recommend signing up for a free account so you can fork any demos.

Course Resources

I’ll be adding to these in the next few weeks (as of early May)

Plotly

D3 Resources