Dictionaries
Another data structure available in Python, is the dictionary. Dictionaries are unordered structures for storing objects.
Previously with lists, we saw that they were ordered. We could access an entry by its index, and we use them when the data we are representing is positional and want to retrieve objects based on their location. For example, this is one possible sentence from a GPS, and it is comma delimited. If I convert these values to a list, index [1] will always be the time in UTC.
GNGGA,120113.00,5510.0019168,N,00726.0946454,W,4,12,0.60,109.635,M,53.911,M,1.0,0000*73
Dictionaries have a key pair format, uniquely identifying each entry, without needing to know its location. The format uses curly braces and is {“key1”:”value1”, “key2”:”value2”}
For example:

If I need the value of the key name, I retrieve it by key, not by its index.
I do not need to know which order the value is in, however, I cannot index or slice a dictionary.
Keys must always be strings.
I can add a key:value pair to the dictionary as follows.

I can edit any individual value in place. I have added comments to break up the code.

A dictionary can hold any type of object, for example, other dictionaries or lists.
If I am working with large scientific data sets, for example for environmental, weather, physics, or maritime data, they will always be provided in lists and dictionaries.
Exercise
Try using the methods
my_dictionary.keys()
my_dictionary.values()
my_dictionary.items()