Skip to content

BUG/API: comparison datetime64-vs-dates #62157

@jbrockmendel

Description

@jbrockmendel
ser = pd.Series(["2016-01-01"], dtype="date32[pyarrow]")
ser2 = ser.astype("timestamp[ns][pyarrow]")
ser3 = ser.astype("datetime64[ns]")

assert (ser3 != ser[0]).all()
assert (ser3 != ser).all()

assert (ser == ser3).all()  # <- uh-oh! inconsistent with reversed operation
assert (ser == ser2).all()  # inconsistent with the non-pyarrow behavior
assert (ser2 == ser).all()

Long ago we made a decision that datetime64 arrays (and Timestamp) were not comparable to date objects, matching the stdlib behavior. We should have that behavior for pyarrow dtypes too.

Metadata

Metadata

Assignees

Labels

BugDatetimeDatetime data dtypeNumeric OperationsArithmetic, Comparison, and Logical operationsdatetime.datestdlib datetime.date support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions