Exploring choropleth maps
Choropleth maps are basically colored polygons representing a certain area on a map. Plotly ships with country maps included (as well as US states), and so it is very easy to plot maps if we have information about countries. We already have such information in our dataset. We have country names, as well as country codes, in every row. We also have the year, some metadata about the countries (region, income group, and so on), and all the indicator data. In other words, every data point is connected to a geographical location. So, let's start by choosing a year and an indicator, and see how the values of our chosen indicator vary across countries:
- Open the
poverty
file into a DataFrame and create theyear
andindicator
variables:import pandas as pd poverty = pd.read_csv('data/poverty.csv') year = 2016 indicator = 'GINI index (World Bank estimate)'
- Create a subset of
poverty
with values from the selected year and containing...