From fe1c5d7a526b186f9ee5f96869abe91b6bd299dc Mon Sep 17 00:00:00 2001 From: Albert Lai Date: Mon, 17 Feb 2025 14:54:21 +0800 Subject: [PATCH] fix bug for dividends with currency When calling history() for Vietnamese stocks, if it contains dividend records, the dividend records will have a currency field, causing an exception. Delete the extra fields from the dividend records to return the history price normally. --- yfinance/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/yfinance/utils.py b/yfinance/utils.py index 201e98789..6bf2c7e36 100644 --- a/yfinance/utils.py +++ b/yfinance/utils.py @@ -532,6 +532,7 @@ def parse_actions(data): dividends.set_index("date", inplace=True) dividends.index = _pd.to_datetime(dividends.index, unit="s") dividends.sort_index(inplace=True) + dividends = dividends[["amount"]] dividends.columns = ["Dividends"] if "capitalGains" in data["events"]: