egttools.datastructures.DataTable

class DataTable(self: egttools.numerical.numerical_.DataStructures.DataTable, nb_rows: SupportsInt | SupportsIndex, nb_columns: SupportsInt | SupportsIndex, headers: collections.abc.Sequence[str], column_types: collections.abc.Sequence[str])

Bases: pybind11_object

Store tabular data together with column headers and column types.

Create a data table.

Parameters:
  • nb_rows (int) – Number of rows in the table.

  • nb_columns (int) – Number of columns in the table.

  • headers (list[str]) – Column names.

  • column_types (list[str]) – Type label for each column.

Examples

>>> from egttools.numerical.DataStructures import DataTable
>>> table = DataTable(
...     2,
...     2,
...     ["name", "value"],
...     ["str", "float"]
... )

Methods

Attributes

cols

Number of columns in the table.

column_types

Column type labels.

data

Table contents.

headers

Column names.

rows

Number of rows in the table.

__init__(self: egttools.numerical.numerical_.DataStructures.DataTable, nb_rows: SupportsInt | SupportsIndex, nb_columns: SupportsInt | SupportsIndex, headers: collections.abc.Sequence[str], column_types: collections.abc.Sequence[str]) None

Create a data table.

Parameters:
  • nb_rows (int) – Number of rows in the table.

  • nb_columns (int) – Number of columns in the table.

  • headers (list[str]) – Column names.

  • column_types (list[str]) – Type label for each column.

Examples

>>> from egttools.numerical.DataStructures import DataTable
>>> table = DataTable(
...     2,
...     2,
...     ["name", "value"],
...     ["str", "float"]
... )
__new__(**kwargs)
__annotations__ = {}
property cols

Number of columns in the table.

property column_types

Column type labels.

Returns:

Type label for each column.

Return type:

list[str]

property data

Table contents.

Returns:

Two-dimensional array storing the table values.

Return type:

numpy.ndarray

property headers

Column names.

Returns:

Header for each column.

Return type:

list[str]

property rows

Number of rows in the table.