Skip to main content

Table

A table for a document: labelled columns, rows of plain values, a caption and a source.

Usage

Source

Table(**data)

Values are stored unformatted; the style formats them when the table is rendered, so one style setting changes every table. A missing value is None. A status column marks pass or fail in place.

Examples

>>> t = Table(id="T3.1", caption="Means",
...           columns=[Column(name="x", label="Mean", unit="pp")], rows=[[1.25]])
>>> t.columns[0].heading

‘Mean (pp)’

Methods

Name Description
from_frame() A table from a pandas frame, the column kinds read from the dtypes.
from_gate() The gate’s checks, one per row, with pass, fail or overridden marked in place.

from_frame()

A table from a pandas frame, the column kinds read from the dtypes.

Usage

Source

from_frame(
    frame,
    *,
    id,
    caption,
    labels=None,
    units=None,
    kinds=None,
    index=None,
    notes=(),
    source=None
)

Integer columns become integer, floats number, datetimes date and everything else text; kinds overrides that. Missing values become empty cells. index, when given, names a first column holding the index (periods as 2024Q1).


from_gate()

The gate’s checks, one per row, with pass, fail or overridden marked in place.

Usage

Source

from_gate(gate, *, id, caption, notes=(), source=None)