When copying a masked table, the mask of MaskedColumn objects is not copied, which leads to weird result: ``` In [1]: %astropy Numpy 1.14.2 Astropy 3.1.dev21681 In [2]: t = Table([[2,4,1,3,6], [3.,2.,np.nan,4,6]], names=('a', 'b'), masked=True) In [3]: t['b'] = np.ma.masked_invalid(t['b']) In [4]: t Out[4]: <Table masked=True length=5> a b int64 float64 ----- ------- 2 3.0 4 2.0 1 -- 3 4.0 6 6.0 In [5]: t2 = t.copy() In [6]: t2.sort('a') In [7]: t2 Out[7]: <Table masked=True length=5> a b int64 float64 ----- ------- 1 -- 2 3.0 3 4.0 4 2.0 6 6.0 In [8]: t Out[8]: <Table masked=True length=5> a b int64 float64 ----- ------- 2 -- 4 2.0 1 nan 3 4.0 6 6.0 ``` Looking at https://github.com/astropy/astropy/blob/master/astropy/table/column.py#L1122-L1133, It seems that the data is copied but not the mask. Maybe @mhvk ?
Activity
yannick1974 commentedon Apr 11, 2018
Note that the problem exists when using numpy 1.14.2 but not numpy 1.13.3. Probably linked to https://docs.scipy.org/doc/numpy/release.html#compatibility-notes
saimn commentedon Apr 11, 2018
Yes indeed, it is due to the fact that the mask is no more always copied (related to #5060, #5530).
Fix copy of mask when copying a Table
Fix copy of mask when copying a Table