Skip to content

BUG: Adding offset produces NonExistentTimeError #36165

Closed
@rhshadrach

Description

@rhshadrach

In #36160, Travis had the following failure:

pandas/tests/tseries/offsets/test_offsets_properties.py:88: 
[snip]
---------------------------------- Hypothesis ----------------------------------
Falsifying example: test_on_offset_implementations(
    dt=datetime.datetime(1900, 1, 1, 0, 0, tzinfo=tzfile('/usr/share/zoneinfo/Iceland')),
    offset=<96 * MonthBegins>,
)
You can reproduce this example by temporarily adding @reproduce_failure('5.29.0', b'AAEAMgAAAAAAAAAAAABgAA==') as a decorator on your test case

Can reproduce with:

from datetime import datetime
import pytz
from pandas.tseries.offsets import MonthBegin

dt = datetime(1900, 1, 1, 0, 0, tzinfo=pytz.timezone('Iceland'))
offset = MonthBegin(96)
dt + offset

which produces the trace:

  File "pandas/_libs/tslibs/offsets.pyx", line 422, in pandas._libs.tslibs.offsets.BaseOffset.__add__
  File "pandas/_libs/tslibs/offsets.pyx", line 424, in pandas._libs.tslibs.offsets.BaseOffset.__add__
  File "pandas/_libs/tslibs/offsets.pyx", line 172, in pandas._libs.tslibs.offsets.apply_wraps.wrapper
  File "pandas/_libs/tslibs/timestamps.pyx", line 1317, in pandas._libs.tslibs.timestamps.Timestamp.tz_localize
  File "pandas/_libs/tslibs/tzconversion.pyx", line 63, in pandas._libs.tslibs.tzconversion.tz_localize_to_utc_single
  File "pandas/_libs/tslibs/tzconversion.pyx", line 319, in pandas._libs.tslibs.tzconversion.tz_localize_to_utc
pytz.exceptions.NonExistentTimeError: 1908-01-01 00:00:00

Not sure if this is a bug or an invalid input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions