First page Back Continue Last page Overview Graphics

Filtering Out Missing Data

It's possible to filter out missing data with the Series method dropna. It returns a Series which consists only of non-null data:

print(my_city_series.dropna())

If we call fillna with a dict, we can provide the appropriate data:

London 8615246.0

Paris 2273305.0

Berlin 3562166.0

Hamburg 1760433.0

dtype: float64

missing_cities = {"Stuttgart":597939, "Zurich":378884}

my_city_series.fillna(missing_cities)

London 8615246.0

Paris 2273305.0

Zurich 378884.0

Berlin 3562166.0

Stuttgart 597939.0

Hamburg 1760433.0

dtype: float64