Skip to content

BUG: bug in nanops.var with ddof=1 and 1 elements would sometimes return inf rather than nan (GH6136) #6204

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

Merged
merged 1 commit into from
Jan 31, 2014

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Jan 31, 2014

closes #6136

@jreback
Copy link
Contributor Author

jreback commented Jan 31, 2014

@y-p I could not reproduce, but this seems likely the problem

…urn inf

     rather than nan on some platforms (GH6136)
jreback added a commit that referenced this pull request Jan 31, 2014
BUG: bug in nanops.var with ddof=1 and 1 elements would sometimes return inf rather than nan (GH6136)
@jreback jreback merged commit ce5faf0 into pandas-dev:master Jan 31, 2014
@ghost
Copy link

ghost commented Jan 31, 2014

Thanks. Could this be a numpy issue? should we ping someone there?

@jreback
Copy link
Contributor Author

jreback commented Jan 31, 2014

It comes down to precision I think;

The following 2 cases end up slightly different if the numerator is exactly 0 or not (which is why it was 'randomly' failing)

I changed it so it doesn't do the computation if the denomincator is 0, problem solved.

In [9]: Series(0.,index=np.arange(5)).values/0.
Out[9]: array([ nan,  nan,  nan,  nan,  nan])

In [10]: (Series(0.,index=np.arange(5)).values+0.1)/0.
Out[10]: array([ inf,  inf,  inf,  inf,  inf])

@ghost
Copy link

ghost commented Jan 31, 2014

That makes sense. Still, the same data behaves differently on the same platform
and numpy. You have to cut fp some slack, but is this really an instance of that?

I'll open a numpy issue just in case. My numerical-fu isn't good enough to call it.

@jreback
Copy link
Contributor Author

jreback commented Jan 31, 2014

not sure I never could reproduce
even with the same exact specs

@ghost
Copy link

ghost commented Jan 31, 2014

are you on conda? they use MKL for numerics.

@jreback
Copy link
Contributor Author

jreback commented Jan 31, 2014

this was a grohkle 1.8 MKL build for windows

@ghost
Copy link

ghost commented Jan 31, 2014

Same here (didn't realize those were compiled against MKL). strange.

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

Successfully merging this pull request may close these issues.

Failing test on win/py2.6/64, TestResample:test_how_lambda_functions
1 participant