Skip to content

API reference / Analyses

tsdive.CompareAnalysis dataclass

CompareAnalysis(
    before: tuple[Timestamp, Timestamp],
    after: tuple[Timestamp, Timestamp],
    source_id: str | None,
    tags: tuple[TagChange, ...],
    pairs: PairTable,
    joint: JointStructure,
    *,
    top: int = 10,
)

Bases: CompareResult

What changed between two periods of one unit, with its report depth.

top is how many rows each rendered table prints before it counts the rest; to_dict() carries every row. frame holds one row per tag with the columns to_dict() lists under tags.

Methods:

Name Description
render

The report tsdive compare prints for the two periods, without colour.

to_dict

The document tsdive compare --json prints, ready for json.dumps.

Attributes:

Name Type Description
top int
frame DataFrame

_ instance-attribute

_: KW_ONLY

top class-attribute instance-attribute

top: int = 10

frame property

frame: DataFrame

render

render() -> str

The report tsdive compare prints for the two periods, without colour.

Examples:

>>> import tsdive
>>> c = tsdive.compare(["data/demo/fic101_demo.parquet",
...                     "data/demo/tic101_demo.parquet"],
...                    "2024-03-30T20:00:00Z/2024-03-30T23:00:00Z",
...                    "2024-03-31T04:00:00Z/2024-03-31T06:00:00Z")
>>> print(c.render().splitlines()[0])
demo  2 tags   refused 0   pairs 1 of 1 clearing

to_dict

to_dict() -> dict[str, object]

The document tsdive compare --json prints, ready for json.dumps.

The command adds result_kind and tsdive_version in front.