-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown timezone error #1359
Comments
try this answer #1325 (comment) |
What version is pytz? And maybe try upgrading pandas too. |
The pytz version I’m using is 2022.7.1
|
I am using pytz 2022.7.1 with pandas 1.5.3 and pandas-datareader 0.10.0 (PDR below). If it matters, also numpy 1.24.1
My python code now runs |
I am confused because that recommendation doesn't change anything inside If you remove the |
If i remove the tz_localize(None); here's what happens: ***** converting data to worksheet >>> NASDAQ <<< DATA If i go back to yfinance 0.2.3 it also fixes the problem |
sorry about the file references - I redacted the names to remove identifying or sensitive file locations, but was not circumspect in scrubbing them all to the same stub of ".....\Newsletter\ |
No worries. This is an Excel problem not |
I’ll flip to closed. Just FYI I loaded all the version of yfinance
dependencies I’m using on the thread
#1325 (comment)
*From:* ValueRaider ***@***.***>
*Sent:* Friday, January 27, 2023 11:49 AM
*To:* ranaroussi/yfinance ***@***.***>
*Cc:* tab-co ***@***.***>; Comment ***@***.***>
*Subject:* Re: [ranaroussi/yfinance] Unknown timezone error (Issue #1359)
No worries. This is an Excel problem not yfinance
—
Reply to this email directly, view it on GitHub
<#1359 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5MELBZOEMTALL4FZZR3VJLWUQKDBANCNFSM6AAAAAAUHZVISM>
.
You are receiving this because you commented.Message ID: <
***@***.***>
|
Not sure if this is an Excel issue as yfinance 0.2.3 works perfectly, but
any version after that causes my python code to blow-up. Did yfinance
change how it uses dates after version 0.2.3 thereby affecting Excel? Oh
well, I’ll take it as an Excel issue on a measure of faith.
*From:* ValueRaider ***@***.***>
*Sent:* Friday, January 27, 2023 11:49 AM
*To:* ranaroussi/yfinance ***@***.***>
*Cc:* tab-co ***@***.***>; Comment ***@***.***>
*Subject:* Re: [ranaroussi/yfinance] Unknown timezone error (Issue #1359)
No worries. This is an Excel problem not yfinance
—
Reply to this email directly, view it on GitHub
<#1359 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5MELBZOEMTALL4FZZR3VJLWUQKDBANCNFSM6AAAAAAUHZVISM>
.
You are receiving this because you commented.Message ID: <
***@***.***>
|
Because the code blowing up isn't Suppose Excel could not parse floating-point data, or NaNs - would that be the fault of 0.2.4 restored intended default behaviour of |
Understood. Thanks for the explanation.
*From:* ValueRaider ***@***.***>
*Sent:* Friday, January 27, 2023 12:27 PM
*To:* ranaroussi/yfinance ***@***.***>
*Cc:* tab-co ***@***.***>; Comment ***@***.***>
*Subject:* Re: [ranaroussi/yfinance] Unknown timezone error (Issue #1359)
Because the code blowing up isn't yfinance nor any of its dependencies, and
nothing inherently wrong with data. Returning timezone-aware datetimes is
reasonable, and introduction in 0.1.75 fixed a bunch of user experience
problems.
Suppose Excel could not parse floating-point data, or NaNs - would that be
the fault of yfinance?
0.2.4 restored intended default behaviour of returning timezone-aware, see
#1283 <#1283>.
—
Reply to this email directly, view it on GitHub
<#1359 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5MELB5ECKY54WMAVVAW2YDWUQORHANCNFSM6AAAAAAUHZVISM>
.
You are receiving this because you commented.[image: Image removed by
sender.]Message ID: ***@***.***>
|
I'm getting a strange timezone error that I can't track down. No where am I knowingly accessing the timezone data. It seems to be something going on with Pandas and the data fetch. Any ideas? Using yfinance v0.2.6, Python v3.9, Pandas v1.4.2.
code:
import yfinance as yf
yf.pdr_override()
ticker = yf.Ticker('AAPL')
print('last price = ' + ticker.basic_info['last_price'])
error:
File "/home/pi/.local/lib/python3.9/site-packages/yfinance/base.py", line 103, in getitem
File "/home/pi/.local/lib/python3.9/site-packages/yfinance/base.py", line 221, in last_price
File "/home/pi/.local/lib/python3.9/site-packages/yfinance/base.py", line 116, in _get_1y_prices
File "/home/pi/.local/lib/python3.9/site-packages/yfinance/base.py", line 615, in history
File "/home/pi/.local/lib/python3.9/site-packages/yfinance/utils.py", line 442, in set_df_tz
File "/home/pi/.local/lib/python3.9/site-packages/pandas/core/indexes/datetimes.py", line 268, in tz_convert
File "/home/pi/.local/lib/python3.9/site-packages/pandas/core/arrays/datetimes.py", line 870, in tz_convert
File "pandas/_libs/tslibs/timezones.pyx", line 111, in pandas._libs.tslibs.timezones.maybe_get_tz
File "pandas/_libs/tslibs/timezones.pyx", line 134, in pandas._libs.tslibs.timezones.maybe_get_tz
File "/home/pi/.local/lib/python3.9/site-packages/pytz/init.py", line 188, in timezone
pytz.exceptions.UnknownTimeZoneError: 'America/New_York'
The text was updated successfully, but these errors were encountered: