We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a7d9384 + 42a6a04 commit c5e2ffdCopy full SHA for c5e2ffd
lib/matplotlib/mlab.py
@@ -382,17 +382,7 @@ def detrend_mean(x, axis=None):
382
if axis is not None and axis+1 > x.ndim:
383
raise ValueError('axis(=%s) out of bounds' % axis)
384
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]
+ return x - x.mean(axis, keepdims=True)
396
397
398
def detrend_none(x, axis=None):
0 commit comments