Skip to main content
`Ctrl`+`K`

# TableAttribute

class astropy.table.TableAttribute(default=None)

  Bases: `MetaAttribute`

  Descriptor to define a custom attribute for a Table subclass.

  The value of the `TableAttribute` will be stored in a dict named `__attributes__` that is stored in the table `meta`. The attribute can be accessed and set in the usual way, and it can be provided when creating the object.

  Defining an attribute by this mechanism ensures that it will persist if the table is sliced or serialized, for example as a pickle or ECSV file.

  See the `MetaAttribute` documentation for additional details.

  Parameters:
    default `object`

      Default value for attribute

  Examples

      >>> from astropy.table import Table, TableAttribute
      >>> class MyTable(Table):
      ...     identifier = TableAttribute(default=1)
      >>> t = MyTable(identifier=10)
      >>> t.identifier
      10
      >>> t.meta
      {'__attributes__': {'identifier': 10}}