8000 BUG: Added proper handling of median and percentile when nan's are prese... by empeeu · Pull Request #5753 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Added proper handling of median and percentile when nan's are prese... #5753

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

Merged
merged 3 commits into from
Jun 23, 2015
Merged
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
Moving warning outside of for loop.
  • Loading branch information
empeeu committed Jun 22, 2015
commit 3e82d6db99bc9e32a6f6bcb63cbfccbaa1168a74
8 changes: 4 additions & 4 deletions numpy/lib/function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3083,10 +3083,10 @@ def _median(a, axis=None, out=None, overwrite_input=False):
rout = out
else:
rout = a.dtype.type(np.nan)
else:
for i in range(np.count_nonzero(n.ravel())):
warnings.warn("Invalid value encountered in median",
RuntimeWarning)
elif np.count_nonzero(n.ravel()) > 0:
warnings.warn("Invalid value encountered in median for" +
" %d results" % np.count_nonzero(n.ravel()),
RuntimeWarning)
rout[n] = np.nan
return rout
else:
Expand Down
0