Skip to content
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

API/BUG: empty sum with td64 NaT or timedelta(0)? #37151

Closed
jbrockmendel opened this issue Oct 15, 2020 · 1 comment · Fixed by #37394
Closed

API/BUG: empty sum with td64 NaT or timedelta(0)? #37151

jbrockmendel opened this issue Oct 15, 2020 · 1 comment · Fixed by #37394
Labels
Milestone

Comments

@jbrockmendel
Copy link
Member

ser = pd.Series([], dtype="m8[ns]")

>>> ser.sum()
NaT
>>> pd.Index(ser).sum()
NaT
>>> ser.array.sum()
NaT

>>> ser.to_frame().sum()
0   0 days
dtype: timedelta64[ns]

I think zero makes more sense. Easy fix if we have consensus.

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 15, 2020
@jreback
Copy link
Contributor

jreback commented Oct 16, 2020

this needs to use min_count and return 0 or NaT based on that

@jbrockmendel jbrockmendel added API Design Reduction Operations sum, mean, min, max, etc. and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 18, 2020
jbrockmendel added a commit to jbrockmendel/pandas that referenced this issue Oct 25, 2020
@jreback jreback added this to the 1.2 milestone Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants