Skip to content

BUG: there is no year 0 #55462

@jbrockmendel

Description

@jbrockmendel
ts = pd.Timestamp("001-01-01")
td = pd.Timedelta(days=1).as_unit("s")

>>> ts - td
Timestamp('0-12-31 00:00:00')
>>> (ts - td).year
0

We document in a few places that we are using the Proleptic Gregorian calendar which does not have a year 0. The year before 1AD is 1BC in this calendar.

np.datetime64 objects have the same behavior (cc @sberg)

Expected Behavior

Refuse to parse year 0, create a Timestamp with year=0, subtraction skips year 0.

Or document the current behavior.

Metadata

Metadata

Assignees

Labels

DatetimeDatetime data dtypeNeeds DiscussionRequires discussion from core team before further action

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions