Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Tontonio3 wants to merge19 commits intonumpy:main
base:main
Choose a base branch
Loading
fromTontonio3:quantile-warn
Open
Changes from1 commit
Commits
Show all changes
19 commits
Select commitHold shift + click to select a range
293ea24
added err messages and tests
Tontonio3Mar 27, 2025
ae8cd54
Modified tests and added release note
Tontonio3Mar 27, 2025
565fc75
Fixed tests
Tontonio3Mar 27, 2025
8309d16
Fixed bug to handle object dtypes
Tontonio3Mar 27, 2025
04d05f6
Fixed bug to handle object dtypes
Tontonio3Mar 27, 2025
c76b5ad
Streamlined testing, improved error handling capabilities
Tontonio3Mar 28, 2025
bfcec09
Changed infinite error message
Tontonio3Mar 28, 2025
f06a1f8
Bug fix
Tontonio3Mar 28, 2025
1303b3c
Fixed lint test
Tontonio3Mar 28, 2025
ad95df2
Improved testing
Tontonio3Apr 2, 2025
dc14e6b
Changed error handling, made it faster, removed dtype=object special …
Tontonio3Apr 2, 2025
8eeed6a
More comprehensive testing
Tontonio3Apr 2, 2025
4fe3444
More comprehensive testing
Tontonio3Apr 3, 2025
ba2c398
Fixed lint
Tontonio3Apr 3, 2025
2e8e2ea
Fixed tests
Tontonio3Apr 3, 2025
3a20796
Fixed CircleCI test
Tontonio3Apr 7, 2025
40075b3
streamlined checks
Tontonio3Apr 24, 2025
a83887b
lint fix
Tontonio3Apr 28, 2025
3d1c7b0
lint fix
Tontonio3Apr 28, 2025
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
PrevPrevious commit
NextNext commit
Fixed bug to handle object dtypes
  • Loading branch information
@Tontonio3
Tontonio3 committedMar 27, 2025
commit04d05f6f66e4dd130ef84f56292d35b226e68d6d
2 changes: 1 addition & 1 deletionnumpy/lib/_function_base_impl.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4544,7 +4544,7 @@ def quantile(a,
raise ValueError("Weights must be non-infinite")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: non-infinite-> finite probably

elif np.any(np.isnan(weights)):
raise ValueError("At least one weight is nan")
elif weights.dtypeis object:
elif weights.dtype== object:
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that this loop can still give unexpected errors, because you are here counting on object arrays to be turned into their values as scalars. E.g.,

np.isnan(np.array([1.,None,np.inf])[1])# TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

This will be an uninformative error!

I think we have two choices: just not check forobject dtype, or convert to float before checking (and then passing on it that conversion fails).

for w in weights:
if np.isnan(w):
raise ValueError("At least one weight is nan")
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp