From e7e514028cb057adf865ca49847b8e7d319a76f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Fri, 30 Jun 2023 12:09:19 +0200 Subject: [PATCH] Remove deprecated np.product --- holoviews/core/data/grid.py | 2 +- holoviews/core/data/image.py | 2 +- holoviews/core/data/xarray.py | 4 ++-- holoviews/core/util.py | 4 ++-- holoviews/element/raster.py | 4 ++-- holoviews/element/util.py | 2 +- holoviews/util/_versions.py | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/holoviews/core/data/grid.py b/holoviews/core/data/grid.py index 93f0bba907..f7cefa6a9b 100644 --- a/holoviews/core/data/grid.py +++ b/holoviews/core/data/grid.py @@ -230,7 +230,7 @@ def shape(cls, dataset, gridded=False): if gridded: return shape else: - return (np.product(shape, dtype=np.intp), len(dataset.dimensions())) + return (np.prod(shape, dtype=np.intp), len(dataset.dimensions())) @classmethod diff --git a/holoviews/core/data/image.py b/holoviews/core/data/image.py index c247ba22aa..a6a15d78d8 100644 --- a/holoviews/core/data/image.py +++ b/holoviews/core/data/image.py @@ -91,7 +91,7 @@ def dtype(cls, dataset, dimension): @classmethod def length(cls, dataset): - return np.product(dataset.data.shape[:2], dtype=np.intp) + return np.prod(dataset.data.shape[:2], dtype=np.intp) @classmethod diff --git a/holoviews/core/data/xarray.py b/holoviews/core/data/xarray.py index 8e6f5b79bf..a8d82dbfd3 100644 --- a/holoviews/core/data/xarray.py +++ b/holoviews/core/data/xarray.py @@ -65,7 +65,7 @@ def shape(cls, dataset, gridded=False): else: array = dataset.data[dataset.vdims[0].name] if not gridded: - return (np.product(array.shape, dtype=np.intp), len(dataset.dimensions())) + return (np.prod(array.shape, dtype=np.intp), len(dataset.dimensions())) shape_map = dict(zip(array.dims, array.shape)) return tuple(shape_map.get(kd.name, np.nan) for kd in dataset.kdims[::-1]) @@ -626,7 +626,7 @@ def select(cls, dataset, selection_mask=None, **selection): @classmethod def length(cls, dataset): - return np.product([len(dataset.data[d.name]) for d in dataset.kdims], dtype=np.intp) + return np.prod([len(dataset.data[d.name]) for d in dataset.kdims], dtype=np.intp) @classmethod def dframe(cls, dataset, dimensions): diff --git a/holoviews/core/util.py b/holoviews/core/util.py index c5df536e56..80db22a6b1 100644 --- a/holoviews/core/util.py +++ b/holoviews/core/util.py @@ -1931,13 +1931,13 @@ def cross_index(values, index): the cross product of the values at the supplied index. """ lengths = [len(v) for v in values] - length = np.product(lengths) + length = np.prod(lengths) if index >= length: raise IndexError('Index %d out of bounds for cross-product of size %d' % (index, length)) indexes = [] for i in range(1, len(values))[::-1]: - p = np.product(lengths[-i:]) + p = np.prod(lengths[-i:]) indexes.append(index//p) index -= indexes[-1] * p indexes.append(index) diff --git a/holoviews/element/raster.py b/holoviews/element/raster.py index 337545bd88..9856e0b50f 100644 --- a/holoviews/element/raster.py +++ b/holoviews/element/raster.py @@ -192,7 +192,7 @@ def _coord2matrix(self, coord): return int(round(coord[1])), int(round(coord[0])) def __len__(self): - return np.product(self._zdata.shape) + return np.prod(self._zdata.shape) @@ -755,7 +755,7 @@ def trimesh(self): # Generate triangle simplexes shape = self.dimension_values(2, flat=False).shape s0 = shape[0] - t1 = np.arange(np.product(shape)) + t1 = np.arange(np.prod(shape)) js = (t1//s0) t1s = js*(s0+1)+t1%s0 t2s = t1s+1 diff --git a/holoviews/element/util.py b/holoviews/element/util.py index aed5a45d24..02ec8c5e2f 100644 --- a/holoviews/element/util.py +++ b/holoviews/element/util.py @@ -170,7 +170,7 @@ def _aggregate_dataset(self, obj): vdims = obj.dimensions()[2:] xdim, ydim = dim_labels[:2] shape = (len(ycoords), len(xcoords)) - nsamples = np.product(shape) + nsamples = np.prod(shape) grid_data = {xdim: xcoords, ydim: ycoords} ys, xs = cartesian_product([ycoords, xcoords], copy=True) diff --git a/holoviews/util/_versions.py b/holoviews/util/_versions.py index 8b9ab1f056..aa7f469647 100644 --- a/holoviews/util/_versions.py +++ b/holoviews/util/_versions.py @@ -26,7 +26,7 @@ "geoviews", "hvplot", "matplotlib", - "pillow", + "PIL", "plotly", # Jupyter "IPython", @@ -44,7 +44,7 @@ def show_versions(): print(f"Operating system : {platform.platform()}") _package_version("holoviews") print() - for p in sorted(PACKAGES): + for p in sorted(PACKAGES, key=lambda x: x.lower()): _package_version(p)