Skip to content

Commit

Permalink
fix: remove all mentions of cumproduct (#1954)
Browse files Browse the repository at this point in the history
numpy=2.0 will bring a lot of breaking changes, including the removal of cumproduct. numpy.cumproduct is already deprecated in favor of numpy.cumprod in 1.25; and cumprod is available in 1.23+
  • Loading branch information
keewis authored Mar 15, 2024
1 parent 4324553 commit f2e4081
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
2 changes: 1 addition & 1 deletion pint/facets/numpy/numpy_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ def implementation(a, *args, **kwargs):
return a._REGISTRY.Quantity(func(a_stripped, *args, **kwargs))


for func_str in ("cumprod", "cumproduct", "nancumprod"):
for func_str in ("cumprod", "nancumprod"):
implement_single_dimensionless_argument_func(func_str)

# Handle single-argument consistent unit functions
Expand Down
5 changes: 0 additions & 5 deletions pint/testsuite/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,7 @@ def test_cumprod(self):
def test_cumprod_numpy_func(self):
with pytest.raises(DimensionalityError):
np.cumprod(self.q)
with pytest.raises(DimensionalityError):
np.cumproduct(self.q)
helpers.assert_quantity_equal(np.cumprod(self.q / self.ureg.m), [1, 2, 6, 24])
helpers.assert_quantity_equal(
np.cumproduct(self.q / self.ureg.m), [1, 2, 6, 24]
)
helpers.assert_quantity_equal(
np.cumprod(self.q / self.ureg.m, axis=1), [[1, 2], [3, 12]]
)
Expand Down

1 comment on commit f2e4081

@AdamBajger
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, just randomly noticed the commit message and thought how funny the name "cum product" is and that you are probably removing it for its funny misinterpretation. Glad to see its not like that :D

Please sign in to comment.