One problem in dealing with data analysis tasks consists in missing data.
In our next example, the list (or tuple) passed to the keyword parameter 'index' will not be equal to the keys. This means that some cities from the dictionary will be missing and two cities ("Zurich" and "Stuttgart") don't occur in the dictionary.
>>> import pandas as pd
>>> cities = {"London": 8615246, "Berlin": 3562166, "Madrid": 3165235, "Rome": 2874038, "Paris": 2273305}
>>> my_cities = ["London", "Paris", "Zurich", "Berlin", "Stuttgart", "Hamburg"]
>>> my_city_series = pd.Series(cities, index=my_cities)
>>> my_city_series
London 8615246.0
Paris 2273305.0
Zurich NaN
Berlin 3562166.0
Stuttgart NaN
Hamburg NaN dtype: float64
The cities, which are not included in the dictionary, get the value NaN assigned.
NaN stands for "not a number". It can also be seen as meaning "missing" in our example.