yahooquery icon indicating copy to clipboard operation
yahooquery copied to clipboard

fund_top_holdings mixes results

Open phoenix84pl opened this issue 1 year ago • 0 comments

Describe the bug When you download more tickers and some tickers are not ETFs (so do not have holdings), Dataframe with a result attach further holdings to previous tickers

To Reproduce Steps to reproduce the behavior: tickers: SCHD, AAPL, SPY, MSFT, QQQ result of fund_top_holdings (looks like MSFT has holdings)

/usr/local/lib/python3.10/dist-packages/yahooquery/ticker.py:143: FutureWarning: The behavior of pd.concat with len(keys) != len(objs) is deprecated. In a future version this will raise instead of truncating to the smaller of the two sequences df = pd.concat( symbol holdingName holdingPercent symbol row
SPY 0 AAPL Apple Inc 0.072550 1 MSFT Microsoft Corp 0.065502 2 NVDA NVIDIA Corp 0.061181 3 AMZN Amazon.com Inc 0.035645 4 META Meta Platforms Inc Class A 0.025613 5 GOOGL Alphabet Inc Class A 0.019901 6 BRK-B Berkshire Hathaway Inc Class B 0.017267 7 GOOG Alphabet Inc Class C 0.016446 8 AVGO Broadcom Inc 0.016445 9 TSLA Tesla Inc 0.014867 MSFT 0 HD The Home Depot Inc 0.042606 1 VZ Verizon Communications Inc 0.042086 2 CSCO Cisco Systems Inc 0.041486 3 BLK BlackRock Inc 0.041464 4 TXN Texas Instruments Inc 0.039868 5 PFE Pfizer Inc 0.039848 6 CVX Chevron Corp 0.039825 7 BMY Bristol-Myers Squibb Co 0.039628 8 LMT Lockheed Martin Corp 0.039401 9 KO Coca-Cola Co 0.038476 SCHD 0 AAPL Apple Inc 0.090193 1 MSFT Microsoft Corp 0.081431 2 NVDA NVIDIA Corp 0.075843 3 AVGO Broadcom Inc 0.052568 4 META Meta Platforms Inc Class A 0.050655 5 AMZN Amazon.com Inc 0.049790 6 TSLA Tesla Inc 0.032210 7 COST Costco Wholesale Corp 0.025845 8 GOOGL Alphabet Inc Class A 0.024740 9 GOOG Alphabet Inc Class C 0.023773

Expected behavior No holdings = Nan or False

Desktop (please complete the following information):

  • OS: Ubuntu
  • Version not known :/

phoenix84pl avatar Oct 09 '24 23:10 phoenix84pl