Skip to content

BUG: offsets normalize and __eq__ #17689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jbrockmendel opened this issue Sep 27, 2017 · 4 comments
Closed

BUG: offsets normalize and __eq__ #17689

jbrockmendel opened this issue Sep 27, 2017 · 4 comments
Labels
Bug Frequency DateOffsets

Comments

@jbrockmendel
Copy link
Member

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.

@jreback
Copy link
Contributor

jreback commented Sep 27, 2017

this is probably a bug. we want to compare all params (though that is not entirely cheap).

@jreback jreback added this to the Next Major Release milestone Sep 27, 2017
@jreback jreback changed the title offsets normalize and __eq__ BUG: offsets normalize and __eq__ Sep 27, 2017
@jbrockmendel jbrockmendel mentioned this issue Sep 27, 2017
59 tasks
@jbrockmendel
Copy link
Member Author

Great. I'll add it to the tslibs TODO list. Don't worry about the cheapness; even without the cythonizing, there are some pretty significant speedups in the pipeline.

@jbrockmendel
Copy link
Member Author

Does fixing the normalize comparison count as a breaking change that needs some special treatment, or can I just go ahead and fix it?

@jbrockmendel
Copy link
Member Author

Closed by #21404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Frequency DateOffsets
Projects
None yet
Development

No branches or pull requests

2 participants