View the step-by-step solution to:


This question was created from Pandas assignment.docx


Can you solve this question in Python?


Question 1 (20%)
Load the energy data from the file Energy Indicators . x1s, which is a list of indicators of energy
supply and renewable electricity production from the United Nations for the year 2013, and should
be put into a DataFrame with the variable name of energy.
Keep in mind that this is an Excel file, and not a comma separated values file. Also, make sure to
exclude the footer and header information from the datafile. The first two columns are unnecessary,
so you should get rid of them, and you should change the column labels so that the columns are:
[ 'Country', 'Energy Supply', 'Energy Supply per Capita', '% Renewable' ]
Convert Energy Supply to gigajoules (there are 1,000,000 gigajoules in a petajoule). For all
countries which have missing data (e.g. data with "...") make sure this is reflected as np . NaN values.
Rename the following list of countries (for use in later questions):
"Republic of Korea": "South Korea", "United States of America": "United
States", "United Kingdom of Great Britain and Northern Ireland": "United
Kingdom", "China, Hong Kong Special Administrative Region": "Hong Kong"
There are also several countries with numbers and/or parenthesis in their name. Be sure to remove
'Bolivia (Plurinational State of ) ' should be 'Bolivia',
'Switzerland17' should be 'Switzerland'.
Next, load the GDP data from the file world_bank . csv, which is a csv containing countries' GDP
from 1960 to 2015 from World Bank. Call this DataFrame GDP
Make sure to skip the header, and rename the following list of countries:
"Korea, Rep. ": "South Korea", "Iran, Islamic Rep. ": "Iran", "Hong Kong
SAR, China": "Hong Kong"

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Python Programming tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors