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
Throw error on non-finite input for binned_statistic_dd() #10664
Conversation
it looks like travis builds failed for python 3.5 and 3.6, two of them look like flaky test failures. One is showing the build failing the test that I add in this PR. This test is passing on my local machine not sure what the issue is here. |
@peterbell10 I got a chance to look at the 2 failing builds tonight. Can you read my comment here and let me know if this makes sense to you? (Please let me know if you have a better idea). One of the 2 looks like something flaky that might resolve on a restart. However, the second one is a failing doctest in the doc for
The way I was able to get it to pass (locally) was to pass skip directives to the plotting commands. Example hunk:
I recall -> #9785 tried that-didn't solve the issue. We the travis builds changed recently to run the doctests? I can change the doctests in this file too but would like a second pair of eyes to confirm what I'm proposing makes sense (and to include in this PR) before I go to make those changes to the |
Just copy-paste the doctest output into the doctests. This can in principle be fixed in the refguide-checker, but updating the example is simpler. |
That will fix the issues with the changes output to namedtuple but wil not fix the abort trap 6 issue with matplotlib.
… On Aug 22, 2019, at 12:04 AM, Evgeni Burovski ***@***.***> wrote:
Just copy-paste the doctest output into the doctests. This can in principle be fixed in the refguide-checker, but updating the example is simpler.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I did that and this fixed the
which resolved the abort trap 6 error. However, when I omit the I'll push the changes to the PR omitting the skip directive and see if that fixes the issue in the CI build. |
@ev-br thanks for your help. I adjusted docstring/doctests and seems to resolve the build issue(s). |
I ran into an issue as well with latest matplotlib and |
Thanks Ralf, I don’t think it helps either, good to know though thanks.
I see the test harness in #10724 is getting a doc build/test option.
I’ll update my local repo and see if that fixes the issue. Given that the Travis builds are fine I’m guessing this is some sort of local setup that is mismatched with Travis.
… On Aug 25, 2019, at 3:47 PM, Ralf Gommers ***@***.***> wrote:
However, when I omit the # doctest: +SKIP directives (locally) on lines that have matplotlib plotting commands the doctests still fail. I'm not sure if this is an issue with my development env being improperly configured or if something else. Any guidance on the dev setup for the doctests to pass w/matplotlib plots is appreciated.
I ran into an issue as well with latest matplotlib and binned_statistic_dd, see gh-10720. Probably doesn't help for you looking at the above failures, but something is fishy it seems.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
this needs a rebase now |
MAINT: throw value error in binned_statistic_dd for non-finite DOC: update doctest examples with namedtuple returns
MAINT: throw value error in binned_statistic_dd for non-finite DOC: update doctest examples with namedtuple returns MAINT: throw value error in binned_statistic_dd for non-finite DOC: update doctest examples with namedtuple returns
2527efb
to
fe045bd
Compare
Always a little scary doing a rebase :) |
all the travis builds succeeded except 1 and the lone failure is an unrelated error when one of the underlying C lang libraries is Error starts here: |
LGTM now, merged. Thanks @rlucas7 |
@courcelm I'm just seeing your post now and there is an opened issue related to this PR that was just opened. Can you check #11365 and if your issue is not the same one, open an issue with a reproducible example of what you error you're getting? Once I have an error message I can take a look but github doesn't notify me about comments on merged PRs. |
@rlucas7, #11382 fixes one problem, but the issue reported by @courcelm is different. The docstrings for The finiteness check should be changed to something like
|
For the record: the problem was reported in a stackoverflow question: https://stackoverflow.com/questions/60623899/why-is-binned-statistic-2d-now-throwing-typeerror |
@@ -310,10 +309,10 @@ def binned_statistic_2d(x, y, values, statistic='mean', | |||
>>> y = [2.1, 2.6, 2.1, 2.1] | |||
>>> binx = [0.0, 0.5, 1.0] | |||
>>> biny = [2.0, 2.5, 3.0] | |||
>>> ret = stats.binned_statistic_2d(x, y, None, 'count', bins=[binx,biny]) | |||
>>> ret = stats.binned_statistic_2d(x, y, x, 'count', bins=[binx,biny]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should not have been necessary, and should be undone when the issue noted in my comment is fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. I'll add a change to revert this one from x
-> None
I think the issue is fixed in the #11382 PR, the check no longer references |
TST: add a nan test case for the backport fix MAINT: revert doctest changes from scipygh-10664
TST: add a nan test case for the backport fix MAINT: revert doctest changes from scipygh-10664
TST: add a nan test case for the backport fix MAINT: revert doctest changes from scipygh-10664
…es or samples (#11382) * MAINT: remove error throw on non-finite values or samples TST: add a nan test case for the backport fix MAINT: revert doctest changes from gh-10664 * TST: add a test for numpy int64 type * MAINT: add support for non python based int types * any int type that does not come directly from python but implements __index__ needs to be caught with the isinstance(bins, int) logic but would not. This changeset adds support for other int types.
Reference issue
(partially) Closes gh-9010
What does this implement/fix?
check if input contains non-finite data, if there are
np.nan
ornp.inf
throw aValueError
Additional information
There is a possibility that the
dedges.min()
here:https://github.com/scipy/scipy/blob/master/scipy/stats/_binned_statistic.py#L583
is a
0.0
value. However, I'm been actively trying to a couple hours to make data on that scenario and it seems rather difficult. If someone has a reproducing example I'm happy to add that to PR but at this time I cannot seem to generate a reproducing example for this scenario. Opening this PR sooner to get the change out in front of people in case they have suggestions or another edge case to add.