In this task, you have to calculate the interquartile range (IQR) and the median values of CO2 emission in kilotonnes for Argentina and Brazil. The conversion for kilton to tonnes is given below. 1 kiloton = 1000 tonnes Note-1: For Argentina, convert the CO2 emission values in tonnes that are located in the Annual CO2 emissions (tonnes) column of the dataframe co2_arg year into kilotonnes and store the resulting values in a variable named co2_arg_year_kt . Based on the values stored in co2_arg_year_kt , calculate the interquartile range (IQR) and the median values. Store the IQR and the median values in the variables named igr_co2_arg and median_co2_arg . Print the values of iqr_co2_arg and median_co2_arg to the output. Note-2: For Brazil, convert the COz emission values in tonnes that are located in the Annual co, emissions (tonnes) column of the dataframe co2_braz_year into kilotonnes and store the resulting values in a variable named co2_braz_year_kt . Based on the values stored in co2_braz_year_kt , calculate the interquartile range (IQR) and the median

COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
1st Edition
ISBN:9780357392676
Author:FREUND, Steven
Publisher:FREUND, Steven
Chapter5: Working With Multiple Worksheets And Workbooks
Section: Chapter Questions
Problem 4AYK
icon
Related questions
Question
100%

Can somebody help me with my homework? I provided screenshots of my code that goes alongside the question. 

*Side note comments would be helpful, but not required.

In this task, you have to calculate the interquartile range (IQR) and the median values of CO2 emission in kilotonnes for Argentina and Brazil. The conversion for kilton to tonnes is given
below.
1 kiloton = 1000 tonnes
Note-1: For Argentina, convert the CO2 emission values in tonnes that are located in the Annual CO2 emissions (tonnes) column of the dataframe co2_arg_year into kilotonnes
and store the resulting values in a variable named co2_arg_year_kt . Based on the values stored in co2_arg_year_kt , calculate the interquartile range (IQR) and the median values.
Store the IQR and the median values in the variables named iqr_co2_arg and median_co2_arg . Print the values of iqr_co2_arg and median_co2_arg to the output.
Note-2: For Brazil, convert the CO2 emission values in tonnes that are located in the Annual co, emissions (tonnes) column of the dataframe co2_braz_year into kilotonnes
and store the resulting values in a variable named co2_braz_year_kt . Based on the values stored in co2_braz_year_kt , calculate the interquartile range (IQR) and the median
values. Store the IQR and the median values in the variables named igr_co2_braz and median_co2_braz . Print the values of igr_co2_braz and median_co2_braz to the
output.
Note-3: You must use an appropriate funtion to calculate the median value of CO2 emission in kilotonnes for Argentina and Brazil.
Hint: describe () function in Pandas might come in handy.
Transcribed Image Text:In this task, you have to calculate the interquartile range (IQR) and the median values of CO2 emission in kilotonnes for Argentina and Brazil. The conversion for kilton to tonnes is given below. 1 kiloton = 1000 tonnes Note-1: For Argentina, convert the CO2 emission values in tonnes that are located in the Annual CO2 emissions (tonnes) column of the dataframe co2_arg_year into kilotonnes and store the resulting values in a variable named co2_arg_year_kt . Based on the values stored in co2_arg_year_kt , calculate the interquartile range (IQR) and the median values. Store the IQR and the median values in the variables named iqr_co2_arg and median_co2_arg . Print the values of iqr_co2_arg and median_co2_arg to the output. Note-2: For Brazil, convert the CO2 emission values in tonnes that are located in the Annual co, emissions (tonnes) column of the dataframe co2_braz_year into kilotonnes and store the resulting values in a variable named co2_braz_year_kt . Based on the values stored in co2_braz_year_kt , calculate the interquartile range (IQR) and the median values. Store the IQR and the median values in the variables named igr_co2_braz and median_co2_braz . Print the values of igr_co2_braz and median_co2_braz to the output. Note-3: You must use an appropriate funtion to calculate the median value of CO2 emission in kilotonnes for Argentina and Brazil. Hint: describe () function in Pandas might come in handy.
A dataset on the CO, emissions (in tonnes) in different countries is given in the co2_emission.csv file. In this task, you have to select all the rows that correspond to the countries
Argentina and Brazil separately between the years 1900 and 1950 (both inclusive).
Note-1: For Argentina, first conditionally select all the rows that correspond to the country Argentina and store it in a variable named co2_arg . Then, apply the conditional selection
again on the rows stored in co2_arg to pick all the rows that correspond to the years 1900 to 1950 and store it in the variable named co2_arg_year . Print co2_arg_year to the
output.
Note-2: For Brazil, first conditionally select all the rows that correspond to the country Brazil and store it in a variable named co2_braz . Then, apply the conditional selection again
on the rows stored in co2_braz to pick all the rows that correspond to the years 1900 to 1950 and store it in the variable named co2_braz_year . Print co2_braz_year to the
output.
#reads co2 emissions file
co2= pd.read_csv('co2_emission.csv')
# makes a subset of the country containing the code ARG
co2_arg=co2[co2['Code']=='ARG']
#Filters the subset between the year 1900 and 1950
co2_arg_year=co2_arg[(co2_arg['Year']>=1900)&(co2_arg['Year']<=1950)]
# makes a subset of the country containing the code BRA
co2_braz=co2[co2['Code']=='BRA']
#Filters the subset between the year 1900 and 1950
co2_braz_year=co2_braz[(co2_braz['Year']>=1900)&(co2_braz['Year']<=1950)]
#runs code
co2_braz_year,co2_arg_year
Transcribed Image Text:A dataset on the CO, emissions (in tonnes) in different countries is given in the co2_emission.csv file. In this task, you have to select all the rows that correspond to the countries Argentina and Brazil separately between the years 1900 and 1950 (both inclusive). Note-1: For Argentina, first conditionally select all the rows that correspond to the country Argentina and store it in a variable named co2_arg . Then, apply the conditional selection again on the rows stored in co2_arg to pick all the rows that correspond to the years 1900 to 1950 and store it in the variable named co2_arg_year . Print co2_arg_year to the output. Note-2: For Brazil, first conditionally select all the rows that correspond to the country Brazil and store it in a variable named co2_braz . Then, apply the conditional selection again on the rows stored in co2_braz to pick all the rows that correspond to the years 1900 to 1950 and store it in the variable named co2_braz_year . Print co2_braz_year to the output. #reads co2 emissions file co2= pd.read_csv('co2_emission.csv') # makes a subset of the country containing the code ARG co2_arg=co2[co2['Code']=='ARG'] #Filters the subset between the year 1900 and 1950 co2_arg_year=co2_arg[(co2_arg['Year']>=1900)&(co2_arg['Year']<=1950)] # makes a subset of the country containing the code BRA co2_braz=co2[co2['Code']=='BRA'] #Filters the subset between the year 1900 and 1950 co2_braz_year=co2_braz[(co2_braz['Year']>=1900)&(co2_braz['Year']<=1950)] #runs code co2_braz_year,co2_arg_year
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 9 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L