yahooquery icon indicating copy to clipboard operation
yahooquery copied to clipboard

ticker.fund_sector_weightings - KeyError: 'None of [0] are in the columns'

Open kabl opened this issue 9 months ago • 0 comments

Describe the bug First of all thank you for this amazing library :+1:

For some ETFs especial Bond based ETFs fund_sector_weightings is throwing an exception. Even when there are multiple symbols in the ticker and just one of them makes trouble (is a Bond based ETF) an exception is thrown.

To Reproduce

from yahooquery import Ticker
import yahooquery

print(yahooquery.__version__)
# > 2.3.7

ticker = Ticker(["IBDX"])
ticker.fund_sector_weightings
# > KeyError: 'None of [0] are in the columns'

# OR 
ticker = Ticker(["IBDX", "SPY"])
ticker.fund_sector_weightings
# > KeyError: 'None of [0] are in the columns'

Expected behavior No exception. E.g.

ticker = Ticker(["IBDX"])
ticker.fund_sector_weightings

"
0","IBDX
"
realestate,0.0
consumer_cyclical,0.0
basic_materials,0.0
consumer_defensive,0.0
technology,0.0
communication_services,0.0
financial_services,0.0
utilities,0.0
industrials,0.0
energy,0.0

kabl avatar May 17 '24 13:05 kabl