-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: quantile should error when weights are all zeros #28595
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
293ea24
ae8cd54
565fc75
8309d16
04d05f6
c76b5ad
bfcec09
f06a1f8
1303b3c
ad95df2
dc14e6b
8eeed6a
4fe3444
ba2c398
2e8e2ea
3a20796
40075b3
a83887b
3d1c7b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4141,7 +4141,6 @@ def test_closest_observation(self): | |
assert_equal(4, np.quantile(arr[0:8], q, method=m)) | ||
assert_equal(4, np.quantile(arr[0:9], q, method=m)) | ||
assert_equal(5, np.quantile(arr, q, method=m)) | ||
|
||
|
||
@pytest.mark.parametrize(["err_msg", "weight"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd parametrize over There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, if you pass in a list rather than an array, you could parametrize over There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
[("Weights must be finite.", [1, np.inf, 1, 1]), | ||
|
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.
Here again we could ensure the common case remains fast by doing:
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.
Trying to keep this inline:
You're right, I was too sloppy in writing this, the
else
should beelif np.any(weights <0)
so that the case of some weights 0 falls through (slowly, but better than making all cases slow!).p.s. Given this, I'd probably swap the order, i.e.,
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.
@Tontonio3 I don't see how you responded to this suggestion. Please make sure all reviewer feedback is addressed before requesting re-review.
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.
@ngoldbaum Your're right, I forgot to implement this