Thanks to visit codestin.com Credit goes to github.com
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 4833c88 + 230ab94 commit 9af32e6Copy full SHA for 9af32e6
lib/matplotlib/mlab.py
@@ -280,17 +280,7 @@ def detrend_mean(x, axis=None):
280
if axis is not None and axis+1 > x.ndim:
281
raise ValueError('axis(=%s) out of bounds' % axis)
282
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]
+ return x - x.mean(axis, keepdims=True)
294
295
296
def detrend_none(x, axis=None):
0 commit comments