Reader small image

You're reading from  Interactive Data Visualization with Python - Second Edition

Product typeBook
Published inApr 2020
Reading LevelIntermediate
Publisher
ISBN-139781800200944
Edition2nd Edition
Languages
Right arrow
Authors (4):
Abha Belorkar
Abha Belorkar
author image
Abha Belorkar

Abha Belorkar is an educator and researcher in computer science. She received her bachelor's degree in computer science from Birla Institute of Technology and Science Pilani, India and her Ph.D. from the National University of Singapore. Her current research work involves the development of methods powered by statistics, machine learning, and data visualization techniques to derive insights from heterogeneous genomics data on neurodegenerative diseases.
Read more about Abha Belorkar

Sharath Chandra Guntuku
Sharath Chandra Guntuku
author image
Sharath Chandra Guntuku

Sharath Chandra Guntuku is a researcher in natural language processing and multimedia computing. He received his bachelor's degree in computer science from Birla Institute of Technology and Science, Pilani, India and his Ph.D. from Nanyang Technological University, Singapore. His research aims to leverage large-scale social media image and text data to model social health outcomes and psychological traits. He uses machine learning, statistical analysis, natural language processing, and computer vision to answer questions pertaining to health and psychology in individuals and communities.
Read more about Sharath Chandra Guntuku

Shubhangi Hora
Shubhangi Hora
author image
Shubhangi Hora

Shubhangi Hora is a data scientist, Python developer, and published writer. With a background in computer science and psychology, she is particularly passionate about healthcare-related AI, including mental health. Shubhangi is also a trained musician.
Read more about Shubhangi Hora

Anshu Kumar
Anshu Kumar
author image
Anshu Kumar

Anshu Kumar is a data scientist with over 5 years of experience in solving complex problems in natural language processing and recommendation systems. He has an M.Tech. from IIT Madras in computer science. He is also a mentor at SpringBoard. His current interests are building semantic search, text summarization, and content recommendations for large-scale multilingual datasets.
Read more about Anshu Kumar

View More author details
Right arrow

6. Interactive Visualizations of Data across Geographical Regions

Activity 6: Creating a Choropleth Map to Represent Total Renewable Energy Production and Consumption across the World

Solution

  1. Load the renewable energy production dataset:
    import pandas as pd
    renewable_energy_prod_url = "https://raw.githubusercontent.com/TrainingByPackt/Interactive-Data-Visualization-with-Python/master/datasets/share-of-electricity-production-from-renewable-sources.csv"
    renewable_energy_prod_df = pd.read_csv(renewable_energy_prod_url)
    renewable_energy_prod_df.head()

    The output is as follows:

    Figure 6.29: Renewable sources dataset
  2. Sort the production DataFrame based on the Year feature:
    renewable_energy_prod_df.sort_values(by=['Year'],inplace=True)
    renewable_energy_prod_df.head()

    The output is as follows:

    Figure 6.30: Renewable sources dataset after sorting by year
  3. Generate a choropleth map using the plotly express module animated based on Year:
    import plotly.express as...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Interactive Data Visualization with Python - Second Edition
Published in: Apr 2020Publisher: ISBN-13: 9781800200944

Authors (4)

author image
Abha Belorkar

Abha Belorkar is an educator and researcher in computer science. She received her bachelor's degree in computer science from Birla Institute of Technology and Science Pilani, India and her Ph.D. from the National University of Singapore. Her current research work involves the development of methods powered by statistics, machine learning, and data visualization techniques to derive insights from heterogeneous genomics data on neurodegenerative diseases.
Read more about Abha Belorkar

author image
Sharath Chandra Guntuku

Sharath Chandra Guntuku is a researcher in natural language processing and multimedia computing. He received his bachelor's degree in computer science from Birla Institute of Technology and Science, Pilani, India and his Ph.D. from Nanyang Technological University, Singapore. His research aims to leverage large-scale social media image and text data to model social health outcomes and psychological traits. He uses machine learning, statistical analysis, natural language processing, and computer vision to answer questions pertaining to health and psychology in individuals and communities.
Read more about Sharath Chandra Guntuku

author image
Shubhangi Hora

Shubhangi Hora is a data scientist, Python developer, and published writer. With a background in computer science and psychology, she is particularly passionate about healthcare-related AI, including mental health. Shubhangi is also a trained musician.
Read more about Shubhangi Hora

author image
Anshu Kumar

Anshu Kumar is a data scientist with over 5 years of experience in solving complex problems in natural language processing and recommendation systems. He has an M.Tech. from IIT Madras in computer science. He is also a mentor at SpringBoard. His current interests are building semantic search, text summarization, and content recommendations for large-scale multilingual datasets.
Read more about Anshu Kumar