2 years ago
#30030
Tony
Yfinance and Google Sheets empty dividend table
All,
Background: I have a python script I made to pull info from yfinance and make updates to a Google Sheets file regarding given tickers. When it comes to the dividend history of a stock, I can pull history when inputting a ticker manually, but it returns an empty dividend table when the ticker is pulled from my Sheets file (see this post for context). However, everything else still pulls successfully from yfinance based on getting the ticker from my Sheets file.
Any insights on what the problem is or how to fix it are greatly appreciated!
Snippet of code that will return valid price and financial info, but an empty dividend table.
!pip install yfinance
!pip install gspread-formatting
import yfinance as yf, pandas as pd, gspread
# Assign/open workbook and sheet
sh = gc.open('Stock RIV analysis')
ws = sh.worksheet('Stock Assessment')
stockID = ws.find('Yes') # Flag for records to update in sheets
tick = ws.cell(stockID.row,stockID.col-3).value # Pull ticker from Sheets (located 3 rows prior to Yes flag)
stock = yf.Ticker(tick) # Assign ticker as stock id for rest of job
info = stock.info
print(stock.dividends) # Confirm dividend data
print(stock.financials) # Confirm financial data
python
google-sheets
google-colaboratory
yfinance
0 Answers
Your Answer