in .history(period = 'max') funtion I got this error: AttributeError: 'Index' object has no attribute 'tz_localize'
Hi,
how can I fix the below error?
Code:
google = yf.Ticker("GOOG") google_data = google.history(period="max")
Error:
--> 279 df.index = df.index.tz_localize("UTC").tz_convert( 280 data["chart"]["result"][0]["meta"]["exchangeTimezoneName"]) 282 if params["interval"][-1] == "m": 283 df.index.name = "Datetime"
AttributeError: 'Index' object has no attribute 'tz_localize'
Thanks in advice
Hi, you need to add a line of code to modify the DataFrame index to timezone-insensitive
google = yf.Ticker("GOOG") google_data = google.history(period="max") google_data.index = google_data.index.tz_localize(None) # Remove timezone
@PatrickDionne That won't fix errors originating inside yfinance
@1uislopez What version are you using? I can't find that code. But I've seen error before and potential fix is in branch fix/prices-index-not-datetime for you to test (instructions #1080)