Skip to content

fix quantile all zeros error #28597

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

galio1237
Copy link

BUG: Raise error in quantile when weights sum to zero

Added a check in np.quantile to raise a ValueError when the weights parameter are all zero, preventing invalid computations. Added corresponding tests to verify this behavior.

Closes #28589.

@galio1237
Copy link
Author

Hello,

I'm a new contributor to this project and have submitted this pull request to address [Issue #28589].

However, I noticed that some of the status checks are failing. I've reviewed the output but am unsure how to resolve these issues. Could someone please provide guidance on the reasons for these failures and suggest steps to address them?

Thank you for your assistance.

with pytest.raises(ValueError, match="Weights must contain non-zero value."):
np.quantile(y, 0.5, weights=w, method="inverted_cdf")


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could someone please provide guidance on the reasons for these failures and suggest steps to address them?

You can reproduce the linter failure observed in CI locally by running spin lint on your branch. Purging the extra blank line it complains about will allow spin lint to pass locally and in CI. I checked the full test suite locally on this branch and it seems "ok."

The Qemu job failure in CI is clearly unrelated so don't worry about that.

For bug fixes, we usually prefix commits and titles of PRs with BUG:. You can find the list of prefixes in our docs.

Note for other NumPy devs--gh-28594 is very similar to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Pending authors' response
Development

Successfully merging this pull request may close these issues.

BUG: quantile should error when weights are all zeros
2 participants