Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you please show me what is wrong with my code and show me the correct code for this syntax error? I am trying to

Could you please show me what is wrong with my code and show me the correct code for this syntax error? I am trying to answer the second part of the question

 

image

Image transcription text

Task 1 Read in each of the CSV files for the S&P 100 stocks in a dictionary for us to easily reference and manipulate the data. . Start by reading in the companies and their stock ticker symbols into a dataframe called sp100 , with the "Ticker" column as the index. . Next, create a dictionary called stock_frames . This will serve as a container to store all the historical price data for the component stocks. . Read in the historical price data for all stocks in sp100 as dataframes and store them in stock_frames with the stock's ticker as the key. . For this project, we will only need the columns "Date" and "Adj Close" so limit to just these two columns when reading in the CSV file, with the "Date" column as the dataframe's index. Hint: When reading in the CSV files, you may want to use a loop to iterate the index of *sp100* that was created earlier. 1]: sp100 = pd. read_cav('C:/Users/bwoods/OneDrive - Berkadia/Desktop/Python/Week 6 Project/SP100 (4)/SP100/_SP160. cav', usecols = ['7 sp100 = sp100. squeeze ( ): stock_frames = {} for ticker in sp100: stock_frames [ticker] = pd. read_cav('C:/Users/bwoods/OneDrive - Berkadia/Desktop/Python/Week 6 Project/SP100 (4)/SP100/{ticker index_col ='Date', usecols = ['Date' , 'Adj Close' ]) stock_frames FileNotFoundError Traceback (most recent call last) Cell In [53], line 3 1 stock_frames = {} 2 for ticker in sp100: - -> 3 stock_frames [ticker] = pd. read_cav('C:/Users/bwoods/OneDrive - Berkadia/Desktop/Python/Week 6 Project/SP100 (4)/SP1 00/ {ticker} . cav' , \ index_col ='Date', usecols = ['Date', 'Adj Close' ]) 5 stock_frames

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_2

Step: 3

blur-text-image_3

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Finance questions

Question

What has been your desire for leadership in CVS Health?

Answered: 1 week ago

Question

Question 5) Let n = N and Y Answered: 1 week ago

Answered: 1 week ago

Question

How do you save the results of an SQL query as a table?

Answered: 1 week ago

Question

When do you use a make-table query?

Answered: 1 week ago

Question

26. Name at least two ways a gene could influence alcoholism.

Answered: 1 week ago