Skip to content

Pandas returns 0/y=inf, even when y is a non-zero dataframe or series. #9286

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
JohnNapier opened this issue Jan 17, 2015 · 5 comments
Closed
Labels
Bug Duplicate Report Duplicate issue or pull request Numeric Operations Arithmetic, Comparison, and Logical operations
Milestone

Comments

@JohnNapier
Copy link

Pandas returns the wrong result for the operation 0/y where y is a dataframe or series of non-zero values:

import pandas as pd
y=pd.Series(range(1,10))
print 0/y # wrong

However, this operation would work:

for i in y:print 0/i # correct

I'm using Pandas 0.15.2-1.

@jreback
Copy link
Contributor

jreback commented Jan 17, 2015

this is a dupe of #8445

a pull-request to fix is welcome

@jreback jreback added Numeric Operations Arithmetic, Comparison, and Logical operations Bug labels Jan 17, 2015
@jreback jreback closed this as completed Jan 17, 2015
@jreback jreback added the Duplicate Report Duplicate issue or pull request label Jan 17, 2015
@JohnNapier
Copy link
Author

@keszybz, @jreback, I don't think this is a dupe. In the other issue, the answer should be NaN. In this issue, the answer should be zero. Do you agree?

If so, I suggest to re-open.

@jreback
Copy link
Contributor

jreback commented Jan 17, 2015

It exactly the same causation. A bug in fill_zeros; I cross referenced this, to make this a tests as well.

@JohnNapier
Copy link
Author

@jreback, adding as a test is good. Thanks.

@jreback
Copy link
Contributor

jreback commented Jan 17, 2015

pull-requests are welcome!

This actually is a very straightforward change (meaning I think I put a pointer to exactly where it should be changed and its only a single function). The logic is just off in a case I think.

hint hint hint :)

@jreback jreback added this to the 0.16.0 milestone Jan 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

No branches or pull requests

2 participants