diff options
author | Christian Cleberg <hello@cleberg.net> | 2024-07-08 22:06:36 -0500 |
---|---|---|
committer | Christian Cleberg <hello@cleberg.net> | 2024-07-08 22:06:36 -0500 |
commit | 08303185267d6107603a2fdd507c7d3ec84e40d4 (patch) | |
tree | ce09fc13d0374b76a5125bf4deccf9ecf6574924 /content/blog/2020-09-25-happiness-map.md | |
parent | 19f0a243737d2dedab8b402e2c4519838d9fd6d0 (diff) | |
download | cleberg.net-08303185267d6107603a2fdd507c7d3ec84e40d4.tar.gz cleberg.net-08303185267d6107603a2fdd507c7d3ec84e40d4.tar.bz2 cleberg.net-08303185267d6107603a2fdd507c7d3ec84e40d4.zip |
fix images for 2018 to 2021 posts
Diffstat (limited to 'content/blog/2020-09-25-happiness-map.md')
-rw-r--r-- | content/blog/2020-09-25-happiness-map.md | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/content/blog/2020-09-25-happiness-map.md b/content/blog/2020-09-25-happiness-map.md index f150ea6..ffd8466 100644 --- a/content/blog/2020-09-25-happiness-map.md +++ b/content/blog/2020-09-25-happiness-map.md @@ -64,9 +64,6 @@ geo_data = gpd.read_file('https://raw.githubusercontent.com/datasets/geo-countri geo_data.head() ``` - - Next, let's load the data from the Kaggle dataset. I've downloaded this file, so update the file path if you have it somewhere else. After loading, let's take a look at this dataframe: @@ -77,9 +74,6 @@ happy_data = pd.read_csv(r'~/Downloads/world_happiness_data_2019.csv') happy_data.head() ``` - - # Clean the Data Some countries need to be renamed, or they will be lost when you merge the @@ -126,9 +120,6 @@ merged_df = merged_df.rename(columns = {'ADMIN':'GeoJSON_Country'}) merged_df = merged_df.rename(columns = {'Country or region':'Country'}) ``` - - # Create the Map The data is finally ready to be added to a map. The code below shows the @@ -164,9 +155,6 @@ folium.Choropleth( Let's look at the resulting map. - - # Create a Tooltip on Hover Now that we have a map set up, we could stop. However, I want to add a tooltip @@ -216,8 +204,4 @@ folium.LayerControl().add_to(world_map) world_map ``` -The final image below will show you what the tooltip looks like whenever you -hover over a country. - - +The tooltip will now appear whenever you hover over a country. |