Skip to content

Tick with normalize=True should be disallowed #21434

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 Jun 12, 2018 · 0 comments · Fixed by #21427
Closed

Tick with normalize=True should be disallowed #21434

jbrockmendel opened this issue Jun 12, 2018 · 0 comments · Fixed by #21427
Labels
API Design Error Reporting Incorrect or improved errors from pandas Timedelta Timedelta data type
Milestone

Comments

@jbrockmendel
Copy link
Member

See #21427

The issue is that a (non-Day) Tick object with normalize=True breaks addition monotonicity/associativity:

now = pd.Timestamp.now()
tick = pd.offsets.Minute(n=3, normalize=True)

>>> now
Timestamp('2018-06-11 17:38:10.135400')
>>> now + tick
Timestamp('2018-06-11 00:00:00')

>>> now + 64*tick + 64*tick
Timestamp('2018-06-11 00:00:00')
>>> now + 128*tick
Timestamp('2018-06-12 00:00:00')

The Day tick doesn't have the same problem, but I'd prefer to disallow it rather than make it a double-special-case. (See #20633 for more discussion about how Day should behave)

@gfyoung gfyoung added Bug Error Reporting Incorrect or improved errors from pandas Timedelta Timedelta data type labels Jun 13, 2018
@jreback jreback added this to the 0.24.0 milestone Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Error Reporting Incorrect or improved errors from pandas Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants