From 76199dcc2c0be91a6afa7f495aa66b6d5bb7a5ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 27 Jul 2017 16:40:13 +0200 Subject: [PATCH 1/7] replace rollaxis by moveaxis in numpy.polynomial --- numpy/polynomial/chebyshev.py | 10 +++++----- numpy/polynomial/hermite.py | 10 +++++----- numpy/polynomial/hermite_e.py | 10 +++++----- numpy/polynomial/laguerre.py | 10 +++++----- numpy/polynomial/legendre.py | 10 +++++----- numpy/polynomial/polynomial.py | 10 +++++----- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py index b983b2feca99..8b7911f92fb6 100644 --- a/numpy/polynomial/chebyshev.py +++ b/numpy/polynomial/chebyshev.py @@ -942,7 +942,7 @@ def chebder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 @@ -958,7 +958,7 @@ def chebder(c, m=1, scl=1, axis=0): der[1] = 4*c[2] der[0] = c[1] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1067,7 +1067,7 @@ def chebint(c, m=1, k=[], lbnd=0, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) @@ -1086,7 +1086,7 @@ def chebint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j - 1] -= c[j]/(2*(j - 1)) tmp[0] += k[i] - chebval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1458,7 +1458,7 @@ def chebvander(x, deg): v[1] = x for i in range(2, ideg + 1): v[i] = v[i-1]*x2 - v[i-2] - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def chebvander2d(x, y, deg): diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index ccf0fc14665a..856ac487e7ce 100644 --- a/numpy/polynomial/hermite.py +++ b/numpy/polynomial/hermite.py @@ -706,7 +706,7 @@ def hermder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 @@ -718,7 +718,7 @@ def hermder(c, m=1, scl=1, axis=0): for j in range(n, 0, -1): der[j - 1] = (2*j)*c[j] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -825,7 +825,7 @@ def hermint(c, m=1, k=[], lbnd=0, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) @@ -840,7 +840,7 @@ def hermint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j + 1] = c[j]/(2*(j + 1)) tmp[0] += k[i] - hermval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1229,7 +1229,7 @@ def hermvander(x, deg): v[1] = x2 for i in range(2, ideg + 1): v[i] = (v[i-1]*x2 - v[i-2]*(2*(i - 1))) - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def hermvander2d(x, y, deg): diff --git a/numpy/polynomial/hermite_e.py b/numpy/polynomial/hermite_e.py index 2fafea4af095..e83b263276f0 100644 --- a/numpy/polynomial/hermite_e.py +++ b/numpy/polynomial/hermite_e.py @@ -705,7 +705,7 @@ def hermeder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: return c[:1]*0 @@ -717,7 +717,7 @@ def hermeder(c, m=1, scl=1, axis=0): for j in range(n, 0, -1): der[j - 1] = j*c[j] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -824,7 +824,7 @@ def hermeint(c, m=1, k=[], lbnd=0, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) @@ -839,7 +839,7 @@ def hermeint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j + 1] = c[j]/(j + 1) tmp[0] += k[i] - hermeval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1226,7 +1226,7 @@ def hermevander(x, deg): v[1] = x for i in range(2, ideg + 1): v[i] = (v[i-1]*x - v[i-2]*(i - 1)) - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def hermevander2d(x, y, deg): diff --git a/numpy/polynomial/laguerre.py b/numpy/polynomial/laguerre.py index 387d986fab60..60373b8c8894 100644 --- a/numpy/polynomial/laguerre.py +++ b/numpy/polynomial/laguerre.py @@ -703,7 +703,7 @@ def lagder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 @@ -717,7 +717,7 @@ def lagder(c, m=1, scl=1, axis=0): c[j - 1] += c[j] der[0] = -c[1] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -825,7 +825,7 @@ def lagint(c, m=1, k=[], lbnd=0, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) @@ -841,7 +841,7 @@ def lagint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j + 1] = -c[j] tmp[0] += k[i] - lagval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1228,7 +1228,7 @@ def lagvander(x, deg): v[1] = 1 - x for i in range(2, ideg + 1): v[i] = (v[i-1]*(2*i - 1 - x) - v[i-2]*(i - 1))/i - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def lagvander2d(x, y, deg): diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py index 5a263ef89a25..35c057bea5ec 100644 --- a/numpy/polynomial/legendre.py +++ b/numpy/polynomial/legendre.py @@ -742,7 +742,7 @@ def legder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 @@ -758,7 +758,7 @@ def legder(c, m=1, scl=1, axis=0): der[1] = 3*c[2] der[0] = c[1] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -867,7 +867,7 @@ def legint(c, m=1, k=[], lbnd=0, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) @@ -886,7 +886,7 @@ def legint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j - 1] -= t tmp[0] += k[i] - legval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1259,7 +1259,7 @@ def legvander(x, deg): v[1] = x for i in range(2, ideg + 1): v[i] = (v[i-1]*x*(2*i - 1) - v[i-2]*(i - 1))/i - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def legvander2d(x, y, deg): diff --git a/numpy/polynomial/polynomial.py b/numpy/polynomial/polynomial.py index 4b343bf7d0cc..1528de342dbb 100644 --- a/numpy/polynomial/polynomial.py +++ b/numpy/polynomial/polynomial.py @@ -546,7 +546,7 @@ def polyder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 @@ -558,7 +558,7 @@ def polyder(c, m=1, scl=1, axis=0): for j in range(n, 0, -1): der[j - 1] = j*c[j] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -662,7 +662,7 @@ def polyint(c, m=1, k=[], lbnd=0, scl=1, axis=0): return c k = list(k) + [0]*(cnt - len(k)) - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) for i in range(cnt): n = len(c) c *= scl @@ -676,7 +676,7 @@ def polyint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j + 1] = c[j]/(j + 1) tmp[0] += k[i] - polyval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1147,7 +1147,7 @@ def polyvander(x, deg): v[1] = x for i in range(2, ideg + 1): v[i] = v[i-1]*x - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def polyvander2d(x, y, deg): From 688d2dc522d1b811ff384f140936bb5241df6ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 27 Jul 2017 16:57:26 +0200 Subject: [PATCH 2/7] replace rollaxis by moveaxis everywhere except rollaxis and its tests --- numpy/core/numeric.py | 9 ++++----- numpy/core/tests/test_shape_base.py | 4 ++-- numpy/lib/function_base.py | 14 +++++++------- numpy/lib/nanfunctions.py | 2 +- numpy/lib/tests/test_function_base.py | 4 ++-- numpy/lib/utils.py | 2 +- numpy/linalg/linalg.py | 4 ++-- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index b535cf8463f4..effa3a4bae94 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1618,7 +1618,7 @@ def moveaxis(a, source, destination): # fix hack in scipy which imports this function def _move_axis_to_0(a, axis): - return rollaxis(a, axis, 0) + return moveaxis(a, axis, 0) def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None): @@ -1743,8 +1743,8 @@ def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None): axisb = normalize_axis_index(axisb, b.ndim, msg_prefix='axisb') # Move working axis to the end of the shape - a = rollaxis(a, axisa, a.ndim) - b = rollaxis(b, axisb, b.ndim) + a = moveaxis(a, axisa, -1) + b = moveaxis(b, axisb, -1) msg = ("incompatible dimensions for cross product\n" "(dimension must be 2 or 3)") if a.shape[-1] not in (2, 3) or b.shape[-1] not in (2, 3): @@ -1815,8 +1815,7 @@ def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None): multiply(a0, b1, out=cp2) cp2 -= a1 * b0 - # This works because we are moving the last axis - return rollaxis(cp, -1, axisc) + return moveaxis(cp, -1, axisc) # Use numarray's printing function diff --git a/numpy/core/tests/test_shape_base.py b/numpy/core/tests/test_shape_base.py index 9913af67ac59..d1fbe8e92556 100644 --- a/numpy/core/tests/test_shape_base.py +++ b/numpy/core/tests/test_shape_base.py @@ -208,8 +208,8 @@ def test_exceptions(self): np.concatenate((a, b), axis=axis[0]) # OK assert_raises(ValueError, np.concatenate, (a, b), axis=axis[1]) assert_raises(ValueError, np.concatenate, (a, b), axis=axis[2]) - a = np.rollaxis(a, -1) - b = np.rollaxis(b, -1) + a = np.moveaxis(a, -1, 0) + b = np.moveaxis(b, -1, 0) axis.append(axis.pop(0)) # No arrays to concatenate raises ValueError diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index dda3e021b35a..fcec6937b0be 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -4328,7 +4328,7 @@ def _percentile(a, q, axis=None, out=None, ap.partition(indices, axis=axis) # ensure axis with qth is first - ap = np.rollaxis(ap, axis, 0) + ap = np.moveaxis(ap, axis, 0) axis = 0 # Check if the array contains any nan's @@ -4361,9 +4361,9 @@ def _percentile(a, q, axis=None, out=None, ap.partition(concatenate((indices_below, indices_above)), axis=axis) # ensure axis with qth is first - ap = np.rollaxis(ap, axis, 0) - weights_below = np.rollaxis(weights_below, axis, 0) - weights_above = np.rollaxis(weights_above, axis, 0) + ap = np.moveaxis(ap, axis, 0) + weights_below = np.moveaxis(weights_below, axis, 0) + weights_above = np.moveaxis(weights_above, axis, 0) axis = 0 # Check if the array contains any nan's @@ -4375,8 +4375,8 @@ def _percentile(a, q, axis=None, out=None, x2 = take(ap, indices_above, axis=axis) * weights_above # ensure axis with qth is first - x1 = np.rollaxis(x1, axis, 0) - x2 = np.rollaxis(x2, axis, 0) + x1 = np.moveaxis(x1, axis, 0) + x2 = np.moveaxis(x2, axis, 0) if zerod: x1 = x1.squeeze(0) @@ -5032,7 +5032,7 @@ def insert(arr, obj, values, axis=None): # broadcasting is very different here, since a[:,0,:] = ... behaves # very different from a[:,[0],:] = ...! This changes values so that # it works likes the second case. (here a[:,0:1,:]) - values = np.rollaxis(values, 0, (axis % values.ndim) + 1) + values = np.moveaxis(values, 0, axis) numnew = values.shape[axis] newshape[axis] += numnew new = empty(newshape, arr.dtype, arrorder) diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py index 90120719e252..79bf01281ced 100644 --- a/numpy/lib/nanfunctions.py +++ b/numpy/lib/nanfunctions.py @@ -1174,7 +1174,7 @@ def _nanpercentile(a, q, axis=None, out=None, overwrite_input=False, # Move that axis to the beginning to match percentile's # convention. if q.ndim != 0: - result = np.rollaxis(result, axis) + result = np.moveaxis(result, axis, 0) if out is not None: out[...] = result diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 099a2d407bf5..ce2d862c8b31 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -2958,7 +2958,7 @@ def test_extended_axis(self): o = np.random.normal(size=(71, 23)) x = np.dstack([o] * 10) assert_equal(np.percentile(x, 30, axis=(0, 1)), np.percentile(o, 30)) - x = np.rollaxis(x, -1, 0) + x = np.moveaxis(x, -1, 0) assert_equal(np.percentile(x, 30, axis=(-2, -1)), np.percentile(o, 30)) x = x.swapaxes(0, 1).copy() assert_equal(np.percentile(x, 30, axis=(0, -1)), np.percentile(o, 30)) @@ -3339,7 +3339,7 @@ def test_extended_axis(self): o = np.random.normal(size=(71, 23)) x = np.dstack([o] * 10) assert_equal(np.median(x, axis=(0, 1)), np.median(o)) - x = np.rollaxis(x, -1, 0) + x = np.moveaxis(x, -1, 0) assert_equal(np.median(x, axis=(-2, -1)), np.median(o)) x = x.swapaxes(0, 1).copy() assert_equal(np.median(x, axis=(0, -1)), np.median(o)) diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 6e150add3742..e18eda0fb8bb 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -1138,7 +1138,7 @@ def _median_nancheck(data, result, axis, out): """ if data.size == 0: return result - data = np.rollaxis(data, axis, data.ndim) + data = np.moveaxis(data, axis, -1) n = np.isnan(data[..., -1]) # masked NaN values are ok if np.ma.isMaskedArray(n): diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 0f1966a9bf75..7bf3e227895d 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -22,7 +22,7 @@ array, asarray, zeros, empty, empty_like, transpose, intc, single, double, csingle, cdouble, inexact, complexfloating, newaxis, ravel, all, Inf, dot, add, multiply, sqrt, maximum, fastCopyAndTranspose, sum, isfinite, size, - finfo, errstate, geterrobj, longdouble, rollaxis, amin, amax, product, abs, + finfo, errstate, geterrobj, longdouble, moveaxis, amin, amax, product, abs, broadcast, atleast_2d, intp, asanyarray, isscalar, object_, ones ) from numpy.core.multiarray import normalize_axis_index @@ -2006,7 +2006,7 @@ def _multi_svd_norm(x, row_axis, col_axis, op): """ if row_axis > col_axis: row_axis -= 1 - y = rollaxis(rollaxis(x, col_axis, x.ndim), row_axis, -1) + y = moveaxis(moveaxis(x, col_axis, -1), row_axis, -2) result = op(svd(y, compute_uv=0), axis=-1) return result From 73d833ba3811269114f2f626f7cdc691aa03b427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 27 Jul 2017 17:04:03 +0200 Subject: [PATCH 3/7] deprecate rollaxis() --- numpy/core/numeric.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index effa3a4bae94..617e44c1be5a 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -29,6 +29,8 @@ from .numerictypes import longlong, intc, int_, float_, complex_, bool_ from ._internal import TooHardError, AxisError +from numpy.lib import deprecate + bitwise_not = invert ufunc = type(sin) newaxis = None @@ -1432,6 +1434,7 @@ def roll(a, shift, axis=None): return result +@deprecate(message="Use numpy.moveaxis() instead.") def rollaxis(a, axis, start=0): """ Roll the specified axis backwards, until it lies in a given position. From d735507fd6b103ebf50fb1b0e04fbefe1400d50a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 27 Jul 2017 17:54:50 +0200 Subject: [PATCH 4/7] DEP don't formally deprecate rollaxis, just add a hint to the documentation --- numpy/core/numeric.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 617e44c1be5a..4f3242703650 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -29,8 +29,6 @@ from .numerictypes import longlong, intc, int_, float_, complex_, bool_ from ._internal import TooHardError, AxisError -from numpy.lib import deprecate - bitwise_not = invert ufunc = type(sin) newaxis = None @@ -1434,11 +1432,14 @@ def roll(a, shift, axis=None): return result -@deprecate(message="Use numpy.moveaxis() instead.") def rollaxis(a, axis, start=0): """ Roll the specified axis backwards, until it lies in a given position. + This function continues to be supported for backward compatibility, but you + should prefer np.moveaxis. The np.moveaxis function was added in NumPy + 1.11. + Parameters ---------- a : ndarray From 6a54c0cd2b7e41dc6c2574fed8cde07816be936d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 27 Jul 2017 18:00:35 +0200 Subject: [PATCH 5/7] MAINT replace two moveaxis by one --- numpy/linalg/linalg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 7bf3e227895d..659860592a69 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -2006,7 +2006,7 @@ def _multi_svd_norm(x, row_axis, col_axis, op): """ if row_axis > col_axis: row_axis -= 1 - y = moveaxis(moveaxis(x, col_axis, -1), row_axis, -2) + y = moveaxis(x, [row_axis, col_axis], [-2, -1]) result = op(svd(y, compute_uv=0), axis=-1) return result From 39a602deac40f50288ee295aecd9d087c4ae3141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 27 Jul 2017 23:30:13 +0200 Subject: [PATCH 6/7] MAINT remove workaround for rollaxis --- numpy/linalg/linalg.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 659860592a69..55d18e680e49 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -2004,9 +2004,7 @@ def _multi_svd_norm(x, row_axis, col_axis, op): is `numpy.amin` or `numpy.amax` or `numpy.sum`. """ - if row_axis > col_axis: - row_axis -= 1 - y = moveaxis(x, [row_axis, col_axis], [-2, -1]) + y = moveaxis(x, (row_axis, col_axis), (-2, -1)) result = op(svd(y, compute_uv=0), axis=-1) return result From fefbc2a95f8a2ab3c6008dcd16f8f553e54b9771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 27 Jul 2017 23:40:23 +0200 Subject: [PATCH 7/7] better docstring --- numpy/core/numeric.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 4f3242703650..129c105de346 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1437,7 +1437,7 @@ def rollaxis(a, axis, start=0): Roll the specified axis backwards, until it lies in a given position. This function continues to be supported for backward compatibility, but you - should prefer np.moveaxis. The np.moveaxis function was added in NumPy + should prefer `moveaxis`. The `moveaxis` function was added in NumPy 1.11. Parameters