AttributeError on an Attempt to Create DataFrame Containing Information for Each Ticker from an Excel List

Hello,

I an attempt to extract instrument data from Yahoo based on a list of tickers in an Excel file results in AttributeError implying that “DataFrame” object has no attribute “split”.

Could you please help to understand how to avoid this error and properly extract the information from Yahoo based on the multiple tickers in the Excel spreadsheet?

My goal is to have DataFrame that contains the following information, e.g. as of 19 th of February 2021:

Date;Ticker;Price
19.02.2021;StockA;100
19.02.2021;StockB;10
19.02.2021;StockC;50

I am using this code:

import pandas as pd
import numpy as np
import yfinance as yf
import datetime as dt
from pandas_datareader import data as pdr

yf.pdr_override()

ticker = pd.read_csv("Instrument Scope.csv")
today = dt.datetime.now() 
byear = 2019
bmonth = 1
bday = 1
bdate_output = today - dt.timedelta(30)
bdate = dt.datetime(byear, bmonth, bday)

all_data = {}
for t in ticker:
	all_data[t] = pdr.get_data_yahoo(ticker, start = bdate, end = today)

print(all_data)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.