rheon.ColumnNotFoundError

class rheon.ColumnNotFoundError[source]

Bases: ValueError

The error raised when a column a call reads is not in its input.

For a column a spec reads, its message names the spec, the role the column plays (target, feature, clock, session, weight, group or label) and the column, and lists the input’s columns. rp.stream.embargo and rp.stream.refresh_time raise it too, for a column they name. rp.stream.with_windows raises a plain ValueError instead. rp.eval raises it for a missing group, clock or weight column, and for a target column when spec is the spec dict; a plain ValueError when spec is the spec’s name alone.

It is a ValueError, the class of every other value the bank refuses. rp.ColumnNotFoundError, the class rheon.polars raises, is a subclass of this one and of Polars’ ColumnNotFoundError, which Polars raises for a column a query names that its input does not have. So except rheon.ColumnNotFoundError, except rp.ColumnNotFoundError, Polars’ class and ValueError each catch what a call of rheon.polars raises.

Examples

This code reads df from Example data:

spec = rp.spec.ewridge("ridge", targets=["y"], features=["x0", "x1"], half_life=100.0)
bank = rp.ModelBank([spec])
try:
    bank.fit_predict(df.drop("x1"))
except rheon.ColumnNotFoundError as e:   # or rp.ColumnNotFoundError, or ValueError
    print(type(e).__name__, str(e).split(",")[0])
ColumnNotFoundError spec "ridge": feature column "x1" is not in the input

See also