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 9af32e6

Browse filesBrowse files
authored
Merge pull request #11862 from QuLogic/slice-tuple
Fix NumPy FutureWarning for non-tuple indexing.
2 parents 4833c88 + 230ab94 commit 9af32e6
Copy full SHA for 9af32e6

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
@@ -280,17 +280,7 @@ def detrend_mean(x, axis=None):
280280
if axis is not None and axis+1 > x.ndim:
281281
raise ValueError('axis(=%s) out of bounds' % axis)
282282

283-
# short-circuit 0-D array.
284-
if not x.ndim:
285-
return np.array(0., dtype=x.dtype)
286-
287-
# short-circuit simple operations
288-
if axis == 0 or axis is None or x.ndim <= 1:
289-
return x - x.mean(axis)
290-
291-
ind = [slice(None)] * x.ndim
292-
ind[axis] = np.newaxis
293-
return x - x.mean(axis)[ind]
283+
return x - x.mean(axis, keepdims=True)
294284

295285

296286
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.