Skip to content

BUG: Fix handling of mixed-type arrays in histogram #7864

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
8 changes: 4 additions & 4 deletions numpy/lib/function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from numpy.lib.twodim_base import diag
from .utils import deprecate
from numpy.core.multiarray import (
_insert, add_docstring, digitize, bincount,
_insert, add_docstring, digitize, bincount,
interp as compiled_interp, interp_complex as compiled_interp_complex
)
from numpy.core.umath import _add_newdoc_ufunc as add_newdoc_ufunc
Expand Down Expand Up @@ -660,7 +660,7 @@ def histogram(a, bins=10, range=None, normed=False, weights=None,
if mn > mx:
raise ValueError(
'max must be larger than min in range parameter.')
if not np.all(np.isfinite([mn, mx])):
if not np.all(np.isfinite(np.hstack([mn, mx]))):
Copy link
Member

Choose a reason for hiding this comment

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

This can of worms would be better solved with np.isfinite(mn) and np.isinfinite(mx)

raise ValueError(
'range parameter must be finite.')
if mn == mx:
Expand Down Expand Up @@ -1792,7 +1792,7 @@ def interp(x, xp, fp, left=None, right=None, period=None):

Returns
-------
y : float or complex (corresponding to fp) or ndarray
y : float or complex (corresponding to fp) or ndarray
The interpolated values, same shape as `x`.

Raises
Expand Down Expand Up @@ -1899,7 +1899,7 @@ def interp(x, xp, fp, left=None, right=None, period=None):
return interp_func(x, xp, fp, left, right)
else:
return interp_func(x, xp, fp, left, right).item()

def angle(z, deg=0):
"""
Return the angle of the complex argument.
Expand Down