Jon Reades - j.reades@ucl.ac.uk
1st October 2025
So:
Consider how these two data structures differ:
Or:
So we can mix and match dictionaries and lists in whatever way we need to store… ‘data’. The question is then: what’s the right way to store our data?
How do these data structures differ?
Why does this work for both computers and people?
So 0
always returns information about London, and 2
always returns information about Tokyo. But it’s also easy to ask for the latitude (ds2['lat'][0]
) or time zone (ds2['tz'][0]
) value once you know that 0
is London!
Remember that we can use any immutable ‘thing’ as a key. This means…
We can re-write this into a single line as:
Once you get your head around this, then 🤯🤯🤯 because pandas and everything we do next will make a lot more sense.