Skip to content

DEPS: Address np.cumproduct deprecation #51897

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

Merged
merged 3 commits into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions pandas/core/reshape/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def cartesian_product(X) -> list[np.ndarray]:
return []

lenX = np.fromiter((len(x) for x in X), dtype=np.intp)
cumprodX = np.cumproduct(lenX)
cumprodX = np.cumprod(lenX)

if np.any(cumprodX < 0):
raise ValueError("Product space too large to allocate arrays!")
Expand All @@ -60,7 +60,7 @@ def cartesian_product(X) -> list[np.ndarray]:
return [
tile_compat(
np.repeat(x, b[i]),
np.product(a[i]), # pyright: ignore[reportGeneralTypeIssues]
np.prod(a[i]), # pyright: ignore[reportGeneralTypeIssues]
)
for i, x in enumerate(X)
]
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/groupby/test_libgroupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def test_cython_group_transform_cumsum(np_dtype):
def test_cython_group_transform_cumprod():
# see gh-4095
dtype = np.float64
pd_op, np_op = group_cumprod, np.cumproduct
pd_op, np_op = group_cumprod, np.cumprod
_check_cython_group_transform_cumulative(pd_op, np_op, dtype)


Expand Down