Skip to content

Commit

Permalink
Remove deprecated np.product (#5787)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Jun 30, 2023
1 parent 8df58d3 commit 3f97338
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion holoviews/core/data/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion holoviews/core/data/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions holoviews/core/data/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions holoviews/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions holoviews/element/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)



Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion holoviews/element/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions holoviews/util/_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"geoviews",
"hvplot",
"matplotlib",
"pillow",
"PIL",
"plotly",
# Jupyter
"IPython",
Expand All @@ -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)


Expand Down

0 comments on commit 3f97338

Please sign in to comment.