Skip to content

Commit 7276c75

Browse files
authored
DEPS: Address np.cumproduct deprecation (pandas-dev#51897)
* DEPS: Address np.cumproduct deprecation * Another np.product
1 parent 7b97a46 commit 7276c75

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pandas/core/reshape/util.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def cartesian_product(X) -> list[np.ndarray]:
4141
return []
4242

4343
lenX = np.fromiter((len(x) for x in X), dtype=np.intp)
44-
cumprodX = np.cumproduct(lenX)
44+
cumprodX = np.cumprod(lenX)
4545

4646
if np.any(cumprodX < 0):
4747
raise ValueError("Product space too large to allocate arrays!")
@@ -60,7 +60,7 @@ def cartesian_product(X) -> list[np.ndarray]:
6060
return [
6161
tile_compat(
6262
np.repeat(x, b[i]),
63-
np.product(a[i]), # pyright: ignore[reportGeneralTypeIssues]
63+
np.prod(a[i]), # pyright: ignore[reportGeneralTypeIssues]
6464
)
6565
for i, x in enumerate(X)
6666
]

pandas/tests/groupby/test_libgroupby.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def test_cython_group_transform_cumsum(np_dtype):
194194
def test_cython_group_transform_cumprod():
195195
# see gh-4095
196196
dtype = np.float64
197-
pd_op, np_op = group_cumprod, np.cumproduct
197+
pd_op, np_op = group_cumprod, np.cumprod
198198
_check_cython_group_transform_cumulative(pd_op, np_op, dtype)
199199

200200

0 commit comments

Comments
 (0)