Closed
Description
The handling of nan
values in masked arrays passed in to ma.median
changed some time between 1.10.2 and 1.11.2, and the value returned in 1.11.2 is incorrect. In 1.10.2 nan
was returned in this case. In 1.11.2 an (incorrect) numerical result is returned.
This example demonstrates both problems:
import numpy as np
dm = np.ma.array([1, np.nan, 3])
np.ma.median(dm)
In numpy 1.10.2 the output is as expected: nan
In numpy 1.11.2 the output is incorrect (not nan
and not the correct numerical value ignoring the nan
):
masked_array(data = 3.0,
mask = False,
fill_value = 1e+20)
Based on test failures we are seeing in astropy/astropy#5232, the issue continues in 1.12.0b1.