MCPcopy Create free account
hub / github.com/PyTables/PyTables / Column

Class Column

tables/table.py:3513–3984  ·  view source on GitHub ↗

Accessor for a non-nested column in a table. Each instance of this class is associated with one *non-nested* column of a table. These instances are mainly used to read and write data from the table columns using item access (like the Cols class - see :ref:`ColsClassDescr`), but ther

Source from the content-addressed store, hash-verified

3511
3512
3513class Column:
3514 """Accessor for a non-nested column in a table.
3515
3516 Each instance of this class is associated with one *non-nested* column of a
3517 table. These instances are mainly used to read and write data from the
3518 table columns using item access (like the Cols class - see
3519 :ref:`ColsClassDescr`), but there are a few other associated methods to
3520 deal with indexes.
3521
3522 .. rubric:: Column attributes
3523
3524 .. attribute:: descr
3525
3526 The Description (see :ref:`DescriptionClassDescr`) instance of the
3527 parent table or nested column.
3528
3529 .. attribute:: name
3530
3531 The name of the associated column.
3532
3533 .. attribute:: pathname
3534
3535 The complete pathname of the associated column (the same as
3536 Column.name if the column is not inside a nested column).
3537
3538 .. attribute:: attrs
3539
3540 Column attributes (see :ref:`ColClassDescr`).
3541
3542 Parameters
3543 ----------
3544 table
3545 The parent table instance
3546 name
3547 The name of the column that is associated with this object
3548 descr
3549 The parent description object
3550
3551 """
3552
3553 @lazyattr
3554 def dtype(self) -> np.dtype:
3555 """Return the NumPy dtype that most closely matches this column."""
3556 return self.descr._v_dtypes[self.name].base # Get rid of shape info
3557
3558 @lazyattr
3559 def type(self) -> str: # noqa: A003
3560 """Return the PyTables type of the column (a string)."""
3561 return self.descr._v_types[self.name]
3562
3563 @property
3564 def table(self) -> Table:
3565 """Return the parent Table instance (see :ref:`TableClassDescr`)."""
3566 return self._table_file._get_node(self._table_path)
3567
3568 @property
3569 def index(self) -> Index | None:
3570 """Return the Index instance associated with this column.

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected