Skip to content

Commit

Permalink
Updates to work with numpy 2.0 (#5979)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Nov 6, 2023
1 parent 6c9f359 commit 0ca2aac
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions holoviews/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,8 @@ def dimension_sort(odict, kdims, vdims, key_index):
# Copied from param should make param version public
def is_number(obj):
if isinstance(obj, numbers.Number): return True
elif isinstance(obj, (np.str_, np.unicode_)): return False
elif isinstance(obj, np.str_): return False
elif np.__version__[0] < "2" and isinstance(obj, np.unicode_): return False
# The extra check is for classes that behave like numbers, such as those
# found in numpy, gmpy, etc.
elif (hasattr(obj, '__int__') and hasattr(obj, '__add__')): return True
Expand Down Expand Up @@ -2274,9 +2275,9 @@ def numpy_scalar_to_python(scalar):
Converts a NumPy scalar to a regular python type.
"""
scalar_type = type(scalar)
if np.issubclass_(scalar_type, np.float_):
if issubclass(scalar_type, np.float64):
return float(scalar)
elif np.issubclass_(scalar_type, np.int_):
elif issubclass(scalar_type, np.int_):
return int(scalar)
return scalar

Expand Down

0 comments on commit 0ca2aac

Please sign in to comment.