dpguthrie / dpguthrie/yahooquery

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

Open
#278 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
920
Forks
164
PR merge metrics
No merged PRs in 30d

Description

**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**
```python
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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.