summaryrefslogtreecommitdiff
path: root/numpy/core/fromnumeric.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2023-03-02 18:17:19 -0500
committerGitHub <noreply@github.com>2023-03-02 18:17:19 -0500
commite57ee3fa15234827bebc2500ea89d5d05e895d2f (patch)
treedaf844e97803f7bfac633c28750612b918df22da /numpy/core/fromnumeric.py
parent6736bd9ad4db2b09b055820af7799a9f3d704394 (diff)
parent3dcc33aa585339f36639f78da70bb35f26609bef (diff)
downloadnumpy-e57ee3fa15234827bebc2500ea89d5d05e895d2f.tar.gz
Merge pull request #23314 from rgommers/depr-product-and-co
DEP: deprecate `product`, `cumproduct`, `sometrue`, `alltrue`
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r--numpy/core/fromnumeric.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index ed8b68ecd..7ea2313d1 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -3821,6 +3821,7 @@ def round_(a, decimals=0, out=None):
--------
around : equivalent function; see for details.
"""
+ # 2023-02-28, 1.25.0
warnings.warn("`round_` is deprecated as of NumPy 1.25.0, and will be "
"removed in NumPy 2.0. Please use `round` instead.",
DeprecationWarning, stacklevel=2)
@@ -3832,10 +3833,18 @@ def product(*args, **kwargs):
"""
Return the product of array elements over a given axis.
+ .. deprecated:: 1.25.0
+ ``product`` is deprecated as of NumPy 1.25.0, and will be
+ removed in NumPy 2.0. Please use `prod` instead.
+
See Also
--------
prod : equivalent function; see for details.
"""
+ # 2023-03-02, 1.25.0
+ warnings.warn("`product` is deprecated as of NumPy 1.25.0, and will be "
+ "removed in NumPy 2.0. Please use `prod` instead.",
+ DeprecationWarning, stacklevel=2)
return prod(*args, **kwargs)
@@ -3844,10 +3853,18 @@ def cumproduct(*args, **kwargs):
"""
Return the cumulative product over the given axis.
+ .. deprecated:: 1.25.0
+ ``cumproduct`` is deprecated as of NumPy 1.25.0, and will be
+ removed in NumPy 2.0. Please use `cumprod` instead.
+
See Also
--------
cumprod : equivalent function; see for details.
"""
+ # 2023-03-02, 1.25.0
+ warnings.warn("`cumproduct` is deprecated as of NumPy 1.25.0, and will be "
+ "removed in NumPy 2.0. Please use `cumprod` instead.",
+ DeprecationWarning, stacklevel=2)
return cumprod(*args, **kwargs)
@@ -3858,10 +3875,18 @@ def sometrue(*args, **kwargs):
Refer to `any` for full documentation.
+ .. deprecated:: 1.25.0
+ ``sometrue`` is deprecated as of NumPy 1.25.0, and will be
+ removed in NumPy 2.0. Please use `any` instead.
+
See Also
--------
any : equivalent function; see for details.
"""
+ # 2023-03-02, 1.25.0
+ warnings.warn("`sometrue` is deprecated as of NumPy 1.25.0, and will be "
+ "removed in NumPy 2.0. Please use `any` instead.",
+ DeprecationWarning, stacklevel=2)
return any(*args, **kwargs)
@@ -3870,8 +3895,16 @@ def alltrue(*args, **kwargs):
"""
Check if all elements of input array are true.
+ .. deprecated:: 1.25.0
+ ``alltrue`` is deprecated as of NumPy 1.25.0, and will be
+ removed in NumPy 2.0. Please use `all` instead.
+
See Also
--------
numpy.all : Equivalent function; see for details.
"""
+ # 2023-03-02, 1.25.0
+ warnings.warn("`alltrue` is deprecated as of NumPy 1.25.0, and will be "
+ "removed in NumPy 2.0. Please use `all` instead.",
+ DeprecationWarning, stacklevel=2)
return all(*args, **kwargs)