Skip to main content

Module records

Module records 

Expand description

The one table the Python surface hands back.

The core’s Records is a list of named Columns, and a Column is a typed enum β€” text, number or date. Flattening that into a mapping of lists loses the discriminant, and a dataframe library then infers back what the engine already knew: polars guesses a date column right, pandas gives object, and one absent number turns a numeric column into object too.

So the type crosses whole. to_dict and to_rows are readings of it; to_polars and to_pandas build with a declared schema taken from the column kinds, which is the one thing a free function over a mapping could not do. to_csv writes from the core columns directly and imports nothing.

StructsΒ§

PyRecords
A table of results: named columns of equal length, each carrying its kind.

FunctionsΒ§

cell_to_csv πŸ”’
One cell as a CSV field, quoted only where it must be.
cell_to_py πŸ”’
One cell as a Python object, None for an absent date.
column_to_py πŸ”’
One column as a Python list, each cell at its natural type.
dated_records πŸ”’
A table of (date, value) rows under the two names given.
escape_html πŸ”’
text with the five characters HTML reserves escaped.
import_or_extra πŸ”’
The module name provides, or an ImportError naming the extra that installs it.
kind_of πŸ”’
The kind a column reports, and the word it reports it under.
labelled_records πŸ”’
A table of (label, value) rows, an absent label becoming an empty cell.
render_html πŸ”’
The table as HTML: a caption with the row count, a header row, one row per record, numeric cells right-aligned. The cells are the ones Display prints, so a notebook and a prompt show the same figures.
strip_records πŸ”’
A table of (expiry, end, value) rows under the three names given.