Skip to content

Make documentation more clear on lack of support for masked quantities in tables #10119

@ehsteve

Description

@ehsteve

Description

The current documentation makes it seem like it should be possible to have a column with quantities that are masked. QTable for example allows for masked=True. There are many examples throughout the documentation (for example here) which show a masked column in a QTable.

Expected behavior

from astropy.table import QTable, MaskedColumn
import astropy.units as u

tbl = QTable(masked=True)
tbl.add_column(MaskedColumn([1, 2] * u.keV, mask=[True, False]))
print(tbl)

output

col0
keV 
----
 -
 2.0

Actual behavior

from astropy.table import QTable, MaskedColumn
import astropy.units as u

tbl = QTable(masked=True)
tbl.add_column(MaskedColumn([1, 2] * u.keV, mask=[True, False]))
print(tbl)

output
col0
keV 
----
 1.0
 2.0

Recommendation

Given that masked Quantities arrays are not a thing (see #1852), I would recommend that there be a note or warning adding to the documentation to make it crystal clear that it is currently not possible to make a MaskedColumn with quantities. I might even go so far as to issue a warning when a user tried to create a MaskedColumn with quantities.

System Details

import astropy; print("astropy", astropy.__version__)
'4.0.1.post1'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions