Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 3 and python related. All questions are worth the same number of points except question 1 which is worth 1 7 % of the

Assignment 3
and python related. All questions are worth the same number of points except question 1 which is worth 17% of the assignment grade.
Note: Questions 2-13 rely on your question 1 answer.
[]: import pandas as pd
import numpy as np
# Filter all warnings. If you would like to see the warnings, please comment the two lines below.
import warnings
warnings.filterwarnings('ignore')
Question 1
['Country', 'Energy Supply', 'Energy Supply per Capita', '% Renewable]
Convert Energy Supply to gigajoules (Note: 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):
Next, load the GDP data from the file assets/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"
'2014','2015'].
This function should return a DataFrame with 20 columns and 15 entries, and the rows of the DataFrame should be sorted by "Rank".
def answer_one():
assert type(answer_one())== pd.DataFrame, "Q1: You should return a DataFrame!"
assert answer_one().shape ==(15,2),Q1: Your DataFrame should have 20 columns and 15 entries!"
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions