Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comparison of identical values found by LGTM.com #26827

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
AlexTereshenkov opened this issue Jun 13, 2019 · 5 comments
Closed

Comparison of identical values found by LGTM.com #26827

AlexTereshenkov opened this issue Jun 13, 2019 · 5 comments
Labels

Comments

@AlexTereshenkov
Copy link
Contributor

LGTM.com code analysis website found an interesting issue of comparison of identical values:

https://lgtm.com/projects/g/pandas-dev/pandas/snapshot/fe32cc08cf2e4dbdfa4aad33f3a74fada201600f/files/pandas/core/sparse/frame.py?sort=name&dir=ASC&mode=heatmap#L340

The line

if (value is not None and value == value and method is None and

The value == value looks suspicious. It is there either by mistake or one was trying to check whether the value is float or not since as far as I know, the Boolean value of the comparison will always be the same, unless the value is the floating point value float('nan').

If the latter, then there is a better way to do it with the cmath.isinf(value) and not cmath.isnan(value) to be explicit in the intention. However, maybe there is some bug in numpy or similar that you are trying to work around? @rockg @jreback

I wanted to check with core developers before submitting a PR.

@jreback
Copy link
Contributor

jreback commented Jun 13, 2019

this is indeed to check for float null
np.isnan would be better - note this is deprecated code

@AlexTereshenkov
Copy link
Contributor Author

I see, thanks. Is it clear to the developers that this is deprecated code? I may have missed it.
Would you still like getting a PR on this anyway?

@jreback
Copy link
Contributor

jreback commented Jun 13, 2019

you can PR if u want

@WillAyd WillAyd added the Clean label Jun 13, 2019
@jbrockmendel
Copy link
Member

close-to-duplicate of #20589

@mzeitlin11
Copy link
Member

Closing since I think that code is gone, but please ping to reopen if I've misunderstood

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

5 participants