Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pandas 1.4.0 breaks yfinance 0.1.69 #938

Closed
williewheeler opened this issue Jan 23, 2022 · 1 comment
Closed

pandas 1.4.0 breaks yfinance 0.1.69 #938

williewheeler opened this issue Jan 23, 2022 · 1 comment

Comments

@williewheeler
Copy link

williewheeler commented Jan 23, 2022

Ticker.history() now fails:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [4], in <module>
----> 4 amzn_df = amzn.history(period="max")
      5 msft_df = msft.history(period="max")

File ~/.local/share/virtualenvs/finance-demos-0fMGKKIC/lib/python3.9/site-packages/yfinance/base.py:295, in TickerBase.history(self, period, interval, start, end, prepost, actions, auto_adjust, back_adjust, proxy, rounding, tz, timeout, **kwargs)
    292 df["Stock Splits"].fillna(0, inplace=True)
    294 # index eod/intraday
--> 295 df.index = df.index.tz_localize("UTC").tz_convert(
    296     data["chart"]["result"][0]["meta"]["exchangeTimezoneName"])
    298 if params["interval"][-1] == "m":
    299     df.index.name = "Datetime"

AttributeError: 'Index' object has no attribute 'tz_localize'

Pinning pandas to 1.3.5 makes the error go away.

@williewheeler williewheeler changed the title pandas 1.4.0 appears to have broken yfinance 0.1.69 pandas 1.4.0 breaks yfinance 0.1.69 Jan 23, 2022
@williewheeler
Copy link
Author

Closing, as this duplicates #937.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant