Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import pandas_datareader.data as wb import datetime as date #Step 1(10 points): Remotely Download Treasury Constant Maturity Rate from FRED #(https://fred.stlouisfed.org/categories/115) from 02/01/2014 to 02/01/2016: #6-Month

import pandas_datareader.data as wb

import datetime as date

#Step 1(10 points): Remotely Download "Treasury Constant Maturity Rate" from FRED

#(https://fred.stlouisfed.org/categories/115) from 02/01/2014 to 02/01/2016:

#6-Month

#1-Year

#5-Year

#10-Year

#Step 2( 5 points ): Determine the average and standard deviation for each of the

maturities( maturity is 6-month, 1 year, etc.)

#Step 3( 5 points ): Select only those rows that have value more or less than avg

+/- 1 std

#Step 4( 10 points ): Make a dataframe which has only those rows for which all of

the maturities

#has value outside of avg +/- 1 std. Hint: think about joins for frames in step 3

#Step 5( 5 points): Save the generated dataframe as sigma.xlsx

#Please upload this filled file and sigma.xlsx

MY CODE

import datetime as date import pandas_datareader.data as web start = date.datetime(2014,1,2) end = date.datetime(2016,1,2) start end six_month = web.DataReader('DGS6MO', 'fred', start, end) one_year = web.DataReader('DGS1', 'fred', start, end) five_year = web.DataReader('DGS5', 'fred', start, end) ten_year = web.DataReader('DGS10', 'fred', start, end) average_six_months =six_month["DGS6MO"].mean() std_six_months =six_month["DGS6MO"].std() average_one_year =one_year["DGS1"].mean() std_one_year =one_year["DGS1"].std() average_five_year =five_year["DGS5"].mean() std_five_year =five_year["DGS5"].std() average_ten_year =ten_year["DGS10"].mean() std_ten_year =ten_year["DGS10"].std() rows_between_6 =six_month[(six_month["DGS6MO"]>=average_six_months-std_six_months) & (six_month["DGS6MO"]>=average_six_months+std_six_months)] rows_between_1 =one_year[(one_year["DGS1"]>=average_one_year-std_one_year) & (one_year["DGS1"]>=average_one_year+std_one_year)] rows_between_5 =five_year[(five_year["DGS5"]>=average_five_year-std_five_year) & (five_year["DGS5"]>=average_five_year+std_five_year)] rows_between_10 =ten_year[(ten_year["DGS10"]>=average_ten_year-std_ten_year) & (ten_year["DGS10"]>=average_ten_year+std_ten_year)] ## for 10 years 

This code is step 1 to 3 completed. Can someone help me with step 4 and 5jQuery224040968462160626085_1603456448536 In python

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

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions