format_report()
Format a statistics dictionary into a human-readable report.
Usage
format_report(stats)Takes a dictionary of metric names to values and produces a formatted string table.
Parameters
stats: dict-
A dictionary mapping metric names (str) to their values (numeric).
Returns
str-
A formatted report string.
Notes
The report is formatted as a simple two-column table:
========== ===== Metric Value ========== ===== count 100 mean 42.5 std 12.3 ========== =====
Numeric values are formatted to one decimal place if they are floats, or as integers if they have no fractional part.
Examples
>>> print(format_report({"count": 10, "mean": 5.5}))count: 10 mean: 5.5