Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.14 LAB: Line charts Write a program that subsets the loads and subsets the stock market data in target.csv. Load the the data from target.csv

1.14 LAB: Line charts Write a program that subsets the loads and subsets the stock market data in target.csv. Load the the data from target.csv as target. Create a new data frame, tgt_march, by subsetting the last 19 days of the target data frame. Create a new data frame, tgt_vol, by subsetting the Date and Volume columns. Create a new data frame, tgt_close, by subsetting the Date and Close columns. Using the template from this link, create separate line charts for Volume and Close and upload the resulting output.

If the input is: 3

The output is:

The volume of TGT on 2018-03-05 is 7654766.

The closing stock price of TGT on 2018-03-05 is $75.14.

# import the pandas

module tgt = # load the target.csv file

tgt_march = # subset the last 19 days of the dataframe

tgt_vol = # subset tgt_march and create a data frame that contains the columns: Date and Volume

tgt_close = # subset tgt_march and create a data frame that contains the columns: Date and Closing

day = int(input()) - 1

volume_row = # subset the specific row of tgt_vol for the given day

volume = volume_row.iloc[0][1] # gets the volume for the given day

close_row = # subset the specific row of tgt_close for the given day

close = close_row.iloc[0][1] # gets the closing stock price for the given day

date = tgt_march.iloc[[day]].iloc[0][0] # gets the date

print("The volume of TGT on " + str(date) + " is " + str(int(volume)) + ".")

print("The closing stock price of TGT on " + str(date) + " is $" + str(close) + ".")

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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

How can benchmarking help organisations improve their performance?

Answered: 1 week ago

Question

How many three-digit numbers are divisible by 7?

Answered: 1 week ago

Question

What is Indian Polity and Governance ?

Answered: 1 week ago

Question

Where those not participating, encouraged to participate?

Answered: 1 week ago

Question

3. Who would the members be?

Answered: 1 week ago