lir.aggregation.metrics_csv module

class lir.aggregation.metrics_csv.WriteMetricsToCsv(path: Path, columns: Mapping[str, Callable])[source]

Bases: Aggregation

Helper class to write aggregated results to CSV file.

Parameters:
  • path (Path) – The path to the CSV file where the metrics will be written.

  • columns (Mapping[str, Callable]) – A mapping of column names to metric functions that compute the values for those columns.

close() None[source]

Ensure the CSV file is properly closed after writing.

report(data: AggregationData) None[source]

Write the metrics to CSV.

Parameters:

data (AggregationData) – The aggregated data for which to compute and write the metrics.