Skip to content

BUG: offsets normalize and __eq__ #17689

@jbrockmendel

Description

@jbrockmendel

Two otherwise-identical DateOffsetobjects with different normalize attributes evaluate to equal. But they do not behave equivalently:

In [1]: from pandas.tseries.offsets import * In [2]: import pandas as pd In [3]: ts = pd.Timestamp.now() In [4]: off1 = DateOffset(days=1) In [5]: off2 = DateOffset(days=1, normalize=True) In [6]: off1 == off2 Out[6]: True In [7]: ts + off1 Out[7]: Timestamp('2017-09-27 21:13:54.502976') In [8]: ts + off2 Out[8]: Timestamp('2017-09-27 00:00:00') 

These objects should not be considered equal. If there's consensus, I'll make a PR.

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