yfinance icon indicating copy to clipboard operation
yfinance copied to clipboard

yfinance download(...) function returns either pandas Series or DataFrame

Open AndreiKeino opened this issue 3 years ago • 4 comments

yfinance download(...) function returns either pandas Series or DataFrame. It's quite troublesome. I have to wrap the function in some function that will return dataframe anyway, but you'd better fix this issue eventually.

the code:

tickers = ['A', 'AA']

df = yf.download(tickers)['Close']

# print('close columns for many tcikers = ', df.columns)

print('type of df many tcikers = ', type(df)) # Dataframe

tickers = ['A']

df = yf.download(tickers)['Close']

print('type of df for one ticker = ', type(df)) # Series

AndreiKeino avatar Sep 19 '22 07:09 AndreiKeino

download() is actually returning a Dataframe in both cases. You are then accessing a single column 'Close', you are creating the problem.

ValueRaider avatar Sep 19 '22 11:09 ValueRaider

Your entitled attitude is not helping. yfinance is OSS - you have not paid for it, and no one is being paid to contribute. You are free to contribute.

ValueRaider avatar Sep 19 '22 12:09 ValueRaider

If you think that all the people should help you with this library you are deadly wrong. And, as I see, there will be no support from you on this issue, so I close it.

AndreiKeino avatar Oct 02 '22 07:10 AndreiKeino