Question: Python coding quesition - You are given a CSV file containing stock information. It has the following columns: Date, Open (2), Close, High, Low, Volume,

Python coding quesition - You are given a CSV file containing stock information. It has the following columns: Date, Open (2), Close, High, Low, Volume, and Adj Close. Write function "def testdata" with the following agruments:

Example of data file:

def testdata(filename, col, day): """Queries data loaded intoprogram.  Arguments:  filename: A string for the filename containing the stock data,  in CSV format.  col: A string of either "date", "open", "high", "low", "close",  "volume", or "adj_close" for the column of stock market data to  look into.  The string arguments MUST be LOWERCASE!  day: An integer reflecting the absolute number of the day in the  data to look up, e.g. day 1, 15, or 1200 is row 1, 15, or 1200  in the file.  Returns:  A value selected for the stock on some particular day, in some  column col. The returned value *must* be of the appropriate type,  such as float, int or str.  """

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!