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

Applying np.sum to empty series results in NaN #844

Closed
scouredimage opened this issue Mar 1, 2012 · 2 comments
Closed

Applying np.sum to empty series results in NaN #844

scouredimage opened this issue Mar 1, 2012 · 2 comments
Labels
Milestone

Comments

@scouredimage
Copy link

In [1]: import pandas

In [2]: pandas.__version__
Out[2]: '0.7.1'

In [3]: empty = pandas.Series([], index=[])

In [4]: import numpy as np

In [5]: np.__version__
Out[5]: '1.6.1'

In [6]: np.sum(empty)
Out[6]: nan

In [7]: np.sum(empty.values)
Out[7]: 0.0
@wesm
Copy link
Member

wesm commented Mar 4, 2012

This is a deliberate design choice. I'm not actually sure what's the right behavior. Probably 0 is right but need to think a bit

@wesm wesm closed this as completed in 0fb5725 Mar 15, 2012
@wesm
Copy link
Member

wesm commented Mar 15, 2012

OK, returns 0 now and I agree that's the right choice. will be a part of 0.7.2

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

No branches or pull requests

2 participants