Skip to content
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

median raises assertion error for an empty array #9498

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
6 changes: 5 additions & 1 deletion numba/np/arraymath.py
Expand Up @@ -1595,7 +1595,11 @@ def median_impl(a):
# workspace anyway
temp_arry = a.flatten()
n = temp_arry.shape[0]
return _median_inner(temp_arry, n)
if n != 0:
return _median_inner(temp_arry, n)
else:
raise ValueError('Cannot compute median of an empty array')
adityav1810 marked this conversation as resolved.
Show resolved Hide resolved


return median_impl

Expand Down