ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
14.89k stars 2.44k forks source link

AttributeError: module 'pandas._libs.properties' has no attribute 'tz' #2118

Open justjoehere opened 1 week ago

justjoehere commented 1 week ago

Describe bug

Library Versions: yfinance 0.2.48 and pandas 2.2.3 Python 3.12.7

Attempting to get history results in AttributeError: module 'pandas._libs.properties' has no attribute 'tz'

Simple code that reproduces your problem

import yfinance as yf print(yf.version)

yf.enable_debug_mode()

stock = yf.Ticker('NVDA')

history = stock.history(interval="1d") print(history)

Debug log

DEBUG Entering history() DEBUG Entering history() DEBUG NVDA: Yahoo GET parameters: {'range': '1mo', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'} DEBUG Entering get() DEBUG Entering _make_request() DEBUG url=https://query2.finance.yahoo.com/v8/finance/chart/NVDA DEBUG params={'range': '1mo', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'} DEBUG Entering _get_cookie_and_crumb() DEBUG cookie_mode = 'basic' DEBUG Entering _get_cookie_and_crumb_basic() DEBUG loaded persistent cookie DEBUG reusing cookie DEBUG crumb = 'UvoFIZQnHbH' DEBUG Exiting _get_cookie_and_crumb_basic() DEBUG Exiting _get_cookie_and_crumb() DEBUG response code=200 DEBUG Exiting _make_request() DEBUG Exiting get() DEBUG NVDA: yfinance received OHLC data: 2024-10-09 13:30:00 -> 2024-11-08 21:00:01 DEBUG NVDA: OHLC after cleaning: 2024-10-09 09:30:00-04:00 -> 2024-11-08 16:00:01-05:00

Bad data proof

N/A

yfinance version

0.2.48

Python version

3.12.7

Operating system

Windows 11

boringbyte commented 4 days ago

@justjoehere , tested with yfinance v0.2.49 and pandas v2.2.3 on python 3.12. Did not run into any issue downloading data. Can you try again with updated yfinance library