summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorSamesh <samesh.lakhotia@gmail.com>2019-07-17 19:31:22 +0530
committerSebastian Berg <sebastian@sipsolutions.net>2019-07-31 10:42:18 -0700
commitf483ad1f7fd3868fb2138afdb11f67063e149cf5 (patch)
treef88afba178c45e44c27e1023af50e43406ae5d00 /numpy/core
parent3251dc2bdd322e7fe3cf80d8337f0d4624922321 (diff)
downloadnumpy-f483ad1f7fd3868fb2138afdb11f67063e149cf5.tar.gz
DEP: Remove np.rank which has been deprecated for more than 5 years
references #7059
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/fromnumeric.py29
-rw-r--r--numpy/core/tests/test_deprecations.py10
2 files changed, 1 insertions, 38 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index 3389e7d66..75a6bae7f 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -25,7 +25,7 @@ __all__ = [
'argmin', 'argpartition', 'argsort', 'around', 'choose', 'clip',
'compress', 'cumprod', 'cumproduct', 'cumsum', 'diagonal', 'mean',
'ndim', 'nonzero', 'partition', 'prod', 'product', 'ptp', 'put',
- 'rank', 'ravel', 'repeat', 'reshape', 'resize', 'round_',
+ 'ravel', 'repeat', 'reshape', 'resize', 'round_',
'searchsorted', 'shape', 'size', 'sometrue', 'sort', 'squeeze',
'std', 'sum', 'swapaxes', 'take', 'trace', 'transpose', 'var',
]
@@ -3573,30 +3573,3 @@ def alltrue(*args, **kwargs):
numpy.all : Equivalent function; see for details.
"""
return all(*args, **kwargs)
-
-
-@array_function_dispatch(_ndim_dispatcher)
-def rank(a):
- """
- Return the number of dimensions of an array.
-
- .. note::
- This function is deprecated in NumPy 1.9 to avoid confusion with
- `numpy.linalg.matrix_rank`. The ``ndim`` attribute or function
- should be used instead.
-
- See Also
- --------
- ndim : equivalent non-deprecated function
-
- Notes
- -----
- In the old Numeric package, `rank` was the term used for the number of
- dimensions, but in NumPy `ndim` is used instead.
- """
- # 2014-04-12, 1.9
- warnings.warn(
- "`rank` is deprecated; use the `ndim` attribute or function instead. "
- "To find the rank of a matrix see `numpy.linalg.matrix_rank`.",
- VisibleDeprecationWarning, stacklevel=3)
- return ndim(a)
diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py
index 6d71fcbd6..53e91aa04 100644
--- a/numpy/core/tests/test_deprecations.py
+++ b/numpy/core/tests/test_deprecations.py
@@ -149,16 +149,6 @@ class TestNonTupleNDIndexDeprecation(object):
a[[0, 1]]
-class TestRankDeprecation(_DeprecationTestCase):
- """Test that np.rank is deprecated. The function should simply be
- removed. The VisibleDeprecationWarning may become unnecessary.
- """
-
- def test(self):
- a = np.arange(10)
- assert_warns(np.VisibleDeprecationWarning, np.rank, a)
-
-
class TestComparisonDeprecations(_DeprecationTestCase):
"""This tests the deprecation, for non-element-wise comparison logic.
This used to mean that when an error occurred during element-wise comparison