Open teddyward opened 3 years ago
this bug resurfaced now that it's the fall daylight savings time interim period. Both of the timestamps given below are valid:
>>> pd.date_range('2020-11-02 00:00:00-08:00', '2021-11-02 00:00:00-07:00', tz='America/Los_Angeles')
Traceback (most recent call last):
File "/Users/teddyward/.virtualenvs/kapi/lib/python3.7/site-packages/pandas/core/arrays/datetimes.py", line 2422, in _infer_tz_from_endpoints
inferred_tz = timezones.infer_tzinfo(start, end)
File "pandas/_libs/tslibs/timezones.pyx", line 328, in pandas._libs.tslibs.timezones.infer_tzinfo
AssertionError: Inputs must both have the same timezone, pytz.FixedOffset(-480) != pytz.FixedOffset(-420)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/teddyward/.virtualenvs/kapi/lib/python3.7/site-packages/pandas/core/indexes/datetimes.py", line 1104, in date_range
**kwargs,
File "/Users/teddyward/.virtualenvs/kapi/lib/python3.7/site-packages/pandas/core/arrays/datetimes.py", line 419, in _generate_range
tz = _infer_tz_from_endpoints(start, end, tz)
File "/Users/teddyward/.virtualenvs/kapi/lib/python3.7/site-packages/pandas/core/arrays/datetimes.py", line 2427, in _infer_tz_from_endpoints
) from err
TypeError: Start and end cannot both be tz-aware with different timezones
>>>
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[ ] (optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
The start and end timestamps in the above line of code are both valid timestamps in the
America/Los_Angeles
timezone, but they fail when passed directlyExpected Output
I would expect this to match the output from the following:
Output of
pd.show_versions()