Skip to content

Create ColumnAttribute class (or similar) for mixin columns #3518

@mhvk

Description

@mhvk

This is mostly a reminder that it would be good to have a ColumnAttribute class for mixin columns, which would allow classes that can be used as Table columns to override some aspects. E.g., Quantity could override __str__ if it were a column such that the unit would not be displayed on every line. Similarly, Time and SkyCoord might define to_pandas methods which do some standard conversion that pandas can deal with (see #3504; a bit trickier would be to make this round-trip... some way to store the class used in the pandas dtype?).

From #3011 (comment), the logic internal to Table might be something like:

  1. There is an attribute and it is a subclass of ColumnAttribute[Base]: initialise _col_info using it.
  2. It is present but None: use default ColumnAttribute for initalisation.
  3. It is not present: either try using default, or let user explicitly do it (and take responsibiiity, say with create_mixin_column(s), which might do some tests and then just set that attribute).

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