From f483ad1f7fd3868fb2138afdb11f67063e149cf5 Mon Sep 17 00:00:00 2001 From: Samesh Date: Wed, 17 Jul 2019 19:31:22 +0530 Subject: DEP: Remove np.rank which has been deprecated for more than 5 years references #7059 --- numpy/core/fromnumeric.py | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) (limited to 'numpy/core/fromnumeric.py') 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) -- cgit v1.2.1 From 68626acba30ab59fa1ef27c25eb7ed93f227396e Mon Sep 17 00:00:00 2001 From: Guilherme Leobas Date: Thu, 8 Aug 2019 08:31:42 -0300 Subject: DEP: Deprecate np.alen (#14181) * Deprecate and fix tests for alen --- numpy/core/fromnumeric.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'numpy/core/fromnumeric.py') diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 75a6bae7f..c9ea44425 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -2782,6 +2782,10 @@ def alen(a): 7 """ + # NumPy 1.18.0, 2019-08-02 + warnings.warn( + "`np.alen` is deprecated, use `len` instead", + DeprecationWarning, stacklevel=2) try: return len(a) except TypeError: -- cgit v1.2.1 From 4d734a4e6ef29d1f26a00b515f5f892ccdaf7ef9 Mon Sep 17 00:00:00 2001 From: colinsnyder <47012605+colinsnyder@users.noreply.github.com> Date: Thu, 15 Aug 2019 01:48:50 -0700 Subject: DOC: mention `take_along_axis` in `choose` (#14224) * DOC: mention take_along_axis in choose --- numpy/core/fromnumeric.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'numpy/core/fromnumeric.py') diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index c9ea44425..bde37fca3 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -380,6 +380,7 @@ def choose(a, choices, out=None, mode='raise'): See Also -------- ndarray.choose : equivalent method + numpy.take_along_axis : Preferable if `choices` is an array Notes ----- @@ -908,17 +909,17 @@ def sort(a, axis=-1, kind=None, order=None): .. versionadded:: 1.12.0 - quicksort has been changed to `introsort `_. + quicksort has been changed to `introsort `_. When sorting does not make enough progress it switches to - `heapsort `_. + `heapsort `_. This implementation makes quicksort O(n*log(n)) in the worst case. 'stable' automatically chooses the best stable sorting algorithm - for the data type being sorted. - It, along with 'mergesort' is currently mapped to - `timsort `_ - or `radix sort `_ - depending on the data type. + for the data type being sorted. + It, along with 'mergesort' is currently mapped to + `timsort `_ + or `radix sort `_ + depending on the data type. API forward compatibility currently limits the ability to select the implementation and it is hardwired for the different data types. -- cgit v1.2.1 From 8c0bb22cb5b0979defe11e4befd20f7b79f5da08 Mon Sep 17 00:00:00 2001 From: Isaac Virshup Date: Tue, 27 Aug 2019 12:32:52 +1000 Subject: DOC: Fixed dtype docs for var, nanvar. Docs incorrectly stated that the default output dtype was float32 when input array is of an integer dtype. However: ```python np.var(np.random.randint(0, 100, 1000)).dtype == np.dtype("f8") ``` --- numpy/core/fromnumeric.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/core/fromnumeric.py') diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 08f17aae4..c37dbc5df 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -3410,7 +3410,7 @@ def var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue): instead of a single axis or all the axes as before. dtype : data-type, optional Type to use in computing the variance. For arrays of integer type - the default is `float32`; for arrays of float types it is the same as + the default is `float64`; for arrays of float types it is the same as the array type. out : ndarray, optional Alternate output array in which to place the result. It must have -- cgit v1.2.1