Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 230ab94

Browse filesBrowse files
committed
Fix NumPy FutureWarning for non-tuple indexing.
This fixes the warning: .../matplotlib/mlab.py:395: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
1 parent 8a8c881 commit 230ab94
Copy full SHA for 230ab94

File tree

Expand file treeCollapse file tree

1 file changed

+1
-11
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-11
lines changed

‎lib/matplotlib/mlab.py

Copy file name to clipboardExpand all lines: lib/matplotlib/mlab.py
+1-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -382,17 +382,7 @@ def detrend_mean(x, axis=None):
382382
if axis is not None and axis+1 > x.ndim:
383383
raise ValueError('axis(=%s) out of bounds' % axis)
384384

385-
# short-circuit 0-D array.
386-
if not x.ndim:
387-
return np.array(0., dtype=x.dtype)
388-
389-
# short-circuit simple operations
390-
if axis == 0 or axis is None or x.ndim <= 1:
391-
return x - x.mean(axis)
392-
393-
ind = [slice(None)] * x.ndim
394-
ind[axis] = np.newaxis
395-
return x - x.mean(axis)[ind]
385+
return x - x.mean(axis, keepdims=True)
396386

397387

398388
def detrend_none(x, axis=None):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.