Foundations (Pt. 2)

Overview

This week we will dig into data (lists and dictionaries) in greater detail so that you understand how we design structures to store and organise data to simplify our analysis. We will also look at how frequently-used code can be packaged up in functions and libraries. This is the point at which we begin to engage with code in a more abstract way because we are increasingly interested in reusability and flexibility.

Learning Objectives
  1. To see how ‘simple’ concepts can be (re)combined to tackle complex problems.
  2. To develop an understanding of code re-use through functions.
  3. To develop an appreciation of the utility of packages and namespaces.

This week we also start to move beyond Code Camp, so although you should recognise many of the parts that we discuss, you’ll see that we begin to put them together in a new way. The next two weeks are a critical transition between content that you might have seen before in Code Camp (see Practical) or other introductory materials, and the ‘data science’ approach.

Lectures

Come to class prepared to present/discuss:

Session Video Presentation
Dictionaries Video Slides
LOLs Video Notes
DOLs to Data Video Slides
Functions Video Slides
Packages Video Slides

Other Prep

Readings

You will find Unwin (1980) useful for understanding why the practicals are set up the way they are and why we don’t post ‘answers’ until a few days after the last practical group has completed its session. Donoho (2017) will give you context on how data science might differ from what’s covered in Quantitative Methods, and Etherington (2016) will hopefully help you to see how spatial and programming concepts can be connected to one another to improve our understanding of both. For a particularly good example of this see the GIS Algorithms text (Xiao 2016).

Practical

This week’s practical will take you through the use of dictionaries and introduce the concept of ‘nested’ data structures. We’ll also be looking at how functions (and variables) can be collected into resuable packages that we can either make ourselves or draw on a worldwide bank of experts – I know who I’d rather depend on when the opportunity arises! However, if you have not yet completed Code Camp (or were not aware of it!), then you will benefit enormously from tackling the following sessions:

To run the code for these sessions you can either:

  1. Follow the instructions for running these in Google’s Collaboratory; or
  2. Copy and paste the code into a new Jupyter Notebook and run the code in Docker.
Connections

The practical focusses on:

  • Comparing the use of Python lists and dictionaries to store tabular data.
  • Extending lists and dictionaries into nested data structures.
  • Beginning to make use of packages to access/interact with data.

To access the practical:

  1. Preview on GitHub
  2. Download the Notebook

References

Donoho, D. 2017. “50 Years of Data Science.” Journal of Computational and Graphical Statistics 26 (4):745–66. https://doi.org/10.1007/978-3-642-23430-9_71.
Etherington, Thomas R. 2016. “Teaching Introductory GIS Programming to Geographers Using an Open Source Python Approach.” Journal of Geography in Higher Education 40 (1). Taylor & Francis:117–30.
Unwin, David. 1980. “Make Your Practicals Open-Ended.” Journal of Geography in Higher Education 4 (2). Taylor & Francis:39–42. https://doi.org/10.1080/03098268008708772.
Xiao, Ningchuan. 2016. GIS Algorithms: Theory and Applications for Geographic Information Science & Technology. Research Methods. SAGE. https://doi.org/https://dx.doi.org/10.4135/9781473921498.