We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
from pandas._libs.tslibs.conversion import localize_pydatetime import pandas as pd import pytz ts = pd.Timestamp('2013-11-03 01:59:59.999999') dt = ts.to_pydatetime() tz = pytz.timezone("US/Eastern") >>> localize_pydatetime(dt, tz) datetime.datetime(2013, 11, 3, 1, 59, 59, 999999, tzinfo=<DstTzInfo 'US/Eastern' EST-1 day, 19:00:00 STD>) >>> localize_pydatetime(ts, tz) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "pandas/_libs/tslibs/conversion.pyx", line 629, in pandas._libs.tslibs.conversion.localize_pydatetime cpdef inline datetime localize_pydatetime(datetime dt, tzinfo tz): File "pandas/_libs/tslibs/conversion.pyx", line 645, in pandas._libs.tslibs.conversion.localize_pydatetime return dt.tz_localize(tz) File "pandas/_libs/tslibs/timestamps.pyx", line 2063, in pandas._libs.tslibs.timestamps.Timestamp.tz_localize value = tz_localize_to_utc_single(self.value, tz, File "pandas/_libs/tslibs/tzconversion.pyx", line 176, in pandas._libs.tslibs.tzconversion.tz_localize_to_utc_single return tz_localize_to_utc( File "pandas/_libs/tslibs/tzconversion.pyx", line 353, in pandas._libs.tslibs.tzconversion.tz_localize_to_utc raise pytz.AmbiguousTimeError( pytz.exceptions.AmbiguousTimeError: Cannot infer dst time from 2013-11-03 01:59:59.999999, try using the 'ambiguous' argument
This can be wrapped in a user-facing example with DateOffset addition that I don't have on hand at the moment.
I expected the Timestamp behavior to match the datetime behavior.
The text was updated successfully, but these errors were encountered:
Passing is_dst=None to tz_localize makes the first version raise, xref #55657
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
This can be wrapped in a user-facing example with DateOffset addition that I don't have on hand at the moment.
I expected the Timestamp behavior to match the datetime behavior.
The text was updated successfully, but these errors were encountered: