From b82230fdb438ba368e18ad8d3c55cb4779ab2acf Mon Sep 17 00:00:00 2001 From: Julian Taylor Date: Tue, 13 Jan 2015 08:07:14 +0100 Subject: BUG: fix ma.median used on ndarrays ndarrays have a data attribute pointing to the data buffer which leads to the median working on a byte view instead of the actual type. closes gh-5424 --- numpy/ma/extras.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'numpy/ma/extras.py') diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index 1849df72b..dcf7f39f9 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -41,7 +41,7 @@ import warnings from . import core as ma from .core import MaskedArray, MAError, add, array, asarray, concatenate, count, \ filled, getmask, getmaskarray, make_mask_descr, masked, masked_array, \ - mask_or, nomask, ones, sort, zeros + mask_or, nomask, ones, sort, zeros, getdata #from core import * import numpy as np @@ -671,7 +671,7 @@ def median(a, axis=None, out=None, overwrite_input=False): """ if not hasattr(a, 'mask') or np.count_nonzero(a.mask) == 0: - return masked_array(np.median(getattr(a, 'data', a), axis=axis, + return masked_array(np.median(getdata(a, subok=True), axis=axis, out=out, overwrite_input=overwrite_input), copy=False) if overwrite_input: if axis is None: -- cgit v1.2.1