Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Read in the gold prices from the file ounce of gold is listed in US dollars from January 1950-July 2020. [ ] import pandas
Read in the gold prices from the file ounce of gold is listed in US dollars from January 1950-July 2020. [ ] import pandas as pd [] #get the data df df pd.read_csv(...) https://sueuland.greenriverdev.com/SDEV121/modules/gold.csv where the average monthly price of an + Code Text by-s - Task 2 Run the cell below, and examine the data by answering these questions. [ ] 1. Are there any missing values in the Gold DataFrame? How do you know? 2. Does the Date column contain datetime objects? If not, ensure the Date column contains datetime objects. [] # examine the data [ ] #if needed, convert the Date column entries to datetime objects Task 3 Plot the data with a line plot. You should see a graph similar to what is shown below, but you may use any plotting library. Price 1750 1500 1250 1000 750 500 250 0 1959 1969 1979 1989 1999 2009 2019 Date [] #add your code here - Task 4 Add a column named Year and Quarter that holds the respective year and quarter from the Date field of the Pandas DataFrame. [ ] import datetime as dt #add your code here Task 5 Group the DataFrame by Year and calculate the gold's average price for that year and assign the result to a Pandas Series named avg_prices. When avg_prices is displayed, you should see the following output. Year 1950 34.729167 1951 34.717500 1952 34.628333 1953 34.879167 1954 35.020000 2016 1248.161833 2017 1257.848583 2018 1269.852583 2019 1392.585750 1674.830857 2020 Name: Price, Length: 71, dtype: float64 [ ] #add your code here avg_prices = ... avg_prices Task 6 Create a line plot using the years and average gold prices in avg_prices to create a graph similar to what is shown below: Gold Prices s Cost Per Ounce 1750 1500 1250 1000 750 500 250 1950 1960 1970 1980 1990 2000 2010 2020 Year [ ] #add your code here
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started