Hi
I have the below two data frames that I would like to visualize on a map.
I would like
- A map that shows all the
country
- Each
country
should be colored by itsregion
- It would be nice to have an arrow pointing from
from_country
to theto_country
. - It would be nice to be able to later add interactivity (click selection, tooltips) etc. to the map.
How would I do that
import pandas as pd
countries = pd.DataFrame(
[
{"country": "austria", "region": "central eastern europe"},
{"country": "belgium", "region": "north western europe"},
{"country": "czech", "region": "central eastern europe"},
{"country": "denmark", "region": "north western europe"},
{"country": "france", "region": "north western europe"},
{"country": "germany", "region": "north western europe"},
{"country": "great britain", "region": "north western europe"},
{"country": "ireland", "region": "north western europe"},
{"country": "luxemborg", "region": "north western europe"},
{"country": "netherlands", "region": "north western europe"},
{"country": "norway", "region": "north europe"},
{"country": "poland", "region": "central eastern europe"},
{"country": "russia", "region": "eastern europe"},
{"country": "spain", "region": "southern europe"},
{"country": "switzerland", "region": "southern europe"},
]
)
country_flows = pd.DataFrame(
[
{"from_country": "austria", "to_country": "germany"},
{"from_country": "czech", "to_country": "germany"},
{"from_country": "france", "to_country": "luxemborg"},
{"from_country": "france", "to_country": "spain"},
{"from_country": "france", "to_country": "switzerland"},
{"from_country": "germany", "to_country": "austria"},
{"from_country": "germany", "to_country": "czech"},
{"from_country": "germany", "to_country": "denmark"},
{"from_country": "germany", "to_country": "luxemborg"},
{"from_country": "germany", "to_country": "poland"},
{"from_country": "germany", "to_country": "switzerland"},
{"from_country": "great britain", "to_country": "great britain"},
{"from_country": "great britain", "to_country": "ireland"},
{"from_country": "netherlands", "to_country": "netherlands"},
{"from_country": "norway", "to_country": "belgium"},
{"from_country": "norway", "to_country": "germany"},
{"from_country": "norway", "to_country": "great britain"},
{"from_country": "poland", "to_country": "germany"},
{"from_country": "russia", "to_country": "germany"},
]
)