Question: import pandas as pd # load the target.csv file tgt = pd . read _ csv ( target . csv ) # subset
import pandas as pd
# load the target.csv file
tgt pdreadcsvtargetcsv
# subset the last days of the dataframe
tgtmarch tgt:
# subset tgtmarch and create a data frame that contains the columns: Date and Volume
tgtvol tgtmarchDate"Volume"
# subset tgtmarch and create a data frame that contains the columns: Date and Closing
tgtclose tgtmarchDate"Close"
day intinput
# subset the specific row of tgtvol for the given day
volumerow tgtvolpdtodatetimetgtvolDatedtstrftimed strday
volume volumerow.iloc # gets the volume for the given day
# subset the specific row of tgtclose for the given day
closerow tgtclosepdtodatetimetgtcloseDatedtstrftimed strday
close closerow.iloc # gets the closing stock price for the given day
date tgtmarchpdtodatetimetgtmarchDatedtstrftimed strdayiloc # gets the date
printThe volume of TGT on strdateis strintvolume
printThe closing stock price of TGT on strdateis $ strintclose
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
