Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Follow the steps to graph the yield curves for rows 02/09/06, 02/11/10, 02/10/14, and 02/06/18. (1 point) Import the matplotlib.pyplot package and name the package

Follow the steps to graph the yield curves for rows 02/09/06, 02/11/10, 02/10/14, and 02/06/18.

(1 point) Import the matplotlib.pyplot package and name the package as plt.

(1 point) Define the list interval as [1/12, 3/12, 6/12, 1, 2, 3, 5, 7, 10, 20, 30]. These numbers are used to locate the maturities in the plot.

(1 point) Define the list curves as ['02/09/06', '02/11/10', '02/10/14', '02/06/18']. These strings are used to label the x-axis values and create a legend.

(3 points) Create the yield curves by filling out the following codes:

fig = plt.figure(figsize=(10, 6)) for i in curves: plt.plot(________, ________, label=______) plt.xticks(________, ________, rotation=45) plt.xlabel("Maturity") plt.ylabel("Yield Rates (%)") plt.legend(loc="lower right") plt.grid() plt.show()

where

the first blank of plt.plot is the variable for the horizontal axis,

the second blank of plt.plot is the variable for the vertical axis,

the third blank of plt.plot is the variable for the labels of the curves,

the first blank of plt.xticks is the variable for the actual location in the x-axis, and

the second blank of plt.xticks is the variable for labels on the x-axis.

The resulting plot must be as follows:

Preliminaries: Indexing for a Dataframe

Hint: Replace the ????? part with your solution.

import ????? as ????? interval = ????? curves = ????? fig = plt.figure(figsize=(10, 6)) for i in curves: plt.plot(?????, ?????, label=?????) plt.xticks(?????, ?????, rotation=45) plt.xlabel("Maturity") plt.ylabel("Yield Rates (%)") plt.legend(loc="lower right") plt.grid() plt.show()

CodeText

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

Big Data And Hadoop Fundamentals Tools And Techniques For Data Driven Success

Authors: Mayank Bhushan

2nd Edition

9355516665, 978-9355516664

More Books

Students also viewed these Databases questions

Question

7. Identify key principles of effective negotiations.

Answered: 1 week ago

Question

Distinguish between aptitude and achievement tests.

Answered: 1 week ago