Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following dataframe which consists of the returns of stock A and stock B for last 100 days: >>> df day_number ret_a ret_b 1
Consider the following dataframe which consists of the returns of stock A and stock B for last 100 days: >>> df day_number ret_a ret_b 1 1 -0.000009 -0.000118 2 2 -0.000339 0.000063 3 3 -0.002301 -0.004102 4 4 0.004342 0.001517 5 5 0.000081 0.004946 96 96 0.003541 -0.004451 97 97 0.003017 0.002022 98 98 -0.002707 -0.001887 99 99 -0.000078 -0.002865 100 100 -0.003269 -0.002345 The three dots ... represent the rows from 6 to 95 for brevity. Column "ret_a" denotes the daily returns of stock A, and column "ret_b" denotes the daily returns of stock B Suppose we'd like to prepare a figure that simultaneously includes two subplots together in it. The first subplot will show the daily returns of stock A. The second subplot will show the 10-day moving averages of stock B's returns. We currently have the following code available to us: Line # >>> fig, axes = plt.subplots (nrows = 2, ncols = 1) 1 >>> df['ret_a'].plot (figsize=(10, 6), color = 'navy', grid=True, ax=axes[0]) 2 >>> axes[0].set_xlabel('') 3 >>> axes[0].set_xticklabels('') 4 5 >>> df['ret_b'].rolling (window = 10). median() .plot(figsize=(10, 6), color = 'green', ax=axes[1]) To make sure that we can achieve our objective, a friend makes the following suggestions: 1. Replace "af['ret_a']" with "af['ret_b']"in line 1 II. Replace "ax=axes[0]" with "ax=axes[1]"in line 2 III. Replace "ax-axes[1]" with "ax=axes[2]" in line 5 IV. Replace "median()" with "mean("in line 5 Which suggestion should be adopted together to achieve our objective? O A. Only IV OB. Only I, II, III, and IV O C. Only II, III, and IV OD. Only II and III Consider the following dataframe which consists of the returns of stock A and stock B for last 100 days: >>> df day_number ret_a ret_b 1 1 -0.000009 -0.000118 2 2 -0.000339 0.000063 3 3 -0.002301 -0.004102 4 4 0.004342 0.001517 5 5 0.000081 0.004946 96 96 0.003541 -0.004451 97 97 0.003017 0.002022 98 98 -0.002707 -0.001887 99 99 -0.000078 -0.002865 100 100 -0.003269 -0.002345 The three dots ... represent the rows from 6 to 95 for brevity. Column "ret_a" denotes the daily returns of stock A, and column "ret_b" denotes the daily returns of stock B Suppose we'd like to prepare a figure that simultaneously includes two subplots together in it. The first subplot will show the daily returns of stock A. The second subplot will show the 10-day moving averages of stock B's returns. We currently have the following code available to us: Line # >>> fig, axes = plt.subplots (nrows = 2, ncols = 1) 1 >>> df['ret_a'].plot (figsize=(10, 6), color = 'navy', grid=True, ax=axes[0]) 2 >>> axes[0].set_xlabel('') 3 >>> axes[0].set_xticklabels('') 4 5 >>> df['ret_b'].rolling (window = 10). median() .plot(figsize=(10, 6), color = 'green', ax=axes[1]) To make sure that we can achieve our objective, a friend makes the following suggestions: 1. Replace "af['ret_a']" with "af['ret_b']"in line 1 II. Replace "ax=axes[0]" with "ax=axes[1]"in line 2 III. Replace "ax-axes[1]" with "ax=axes[2]" in line 5 IV. Replace "median()" with "mean("in line 5 Which suggestion should be adopted together to achieve our objective? O A. Only IV OB. Only I, II, III, and IV O C. Only II, III, and IV OD. Only II and
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