Skip to content

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint fix
  • Loading branch information
Tontonio3 committed Apr 28, 2025
commit a83887b6c0bc09d2ee69e9a61f0fdf72d1d44255
5 changes: 1 addition & 4 deletions numpy/lib/tests/test_function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4158,9 +4158,7 @@ def test_inf_zeroes_err(self, err_msg, weight, dty):
a = np.quantile(arr, q, weights=wgts, method=m)

@pytest.mark.parametrize("weight", [[1, np.nan, 1, 1], [1, np.nan, np.nan, 1]])
@pytest.mark.parametrize(["err", "dty"],
[(ValueError, "f8"),
((RuntimeWarning, ValueError), "O")])
@pytest.mark.parametrize(["err", "dty"], [(ValueError, "f8"), ((RuntimeWarning, ValueError), "O")])
def test_nan_err(self, err, dty, weight):

m = "inverted_cdf"
Expand All @@ -4170,7 +4168,6 @@ def test_nan_err(self, err, dty, weight):
with pytest.raises(err):
Copy link
Member

Choose a reason for hiding this comment

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

might as well use match here too

a = np.quantile(arr, q, weights=wgts, method=m)


class TestLerp:
@hypothesis.given(t0=st.floats(allow_nan=False, allow_infinity=False,
min_value=0, max_value=1),
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy