polars_online.OutputColumnNotFoundError

class polars_online.OutputColumnNotFoundError[source]

Bases: ColumnNotFoundError, KeyError

The error raised when a spec’s output column is not in the frame a scoring function reads.

It is a ColumnNotFoundError, so Polars’ own ColumnNotFoundError and ValueError catch it, as they catch any other missing column. It is a KeyError too, the class this refusal raised before. That parent is dropped at the next major version, so catch ColumnNotFoundError. Its text, like any KeyError’s, prints in quotes.

Examples

This code reads df from Example data:

try:
    po.eval.metrics(df, "ridge")   # a frame without the bank's output
except pl.exceptions.ColumnNotFoundError as e:   # or KeyError, until then
    print(type(e).__name__)
OutputColumnNotFoundError

See also