polars_online.ColumnNotFoundError¶
- class polars_online.ColumnNotFoundError[source]¶
Bases:
ColumnNotFoundError,ValueErrorThe 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.
po.stream.embargo,po.stream.refresh_timeandpo.gbdtraise it too, for a column they name.po.stream.with_windowsraises a plainValueErrorinstead.po.evalraises it for a missinggroup,clockorweightcolumn, and for a target column whenspecis the spec dict; a plainValueErrorwhenspecis the spec’s name alone.po.ColumnNotFoundErroris a subclass of Polars’ColumnNotFoundError, which Polars raises for a column a query names that its input does not have, and ofValueError, the class of every other value the bank refuses. So eitherexceptcatches it.Examples
This code reads
dffrom Example data:spec = po.spec.ewridge("ridge", targets=["y"], features=["x0", "x1"], half_life=100.0) bank = po.ModelBank([spec]) try: bank.fit_predict(df.drop("x1")) except pl.exceptions.ColumnNotFoundError as e: # or po.ColumnNotFoundError, or ValueError print(type(e).__name__, str(e).split(",")[0])
ColumnNotFoundError spec "ridge": feature column "x1" is not in the input
See also
OutputColumnNotFoundError, for a spec’s output column that a scoring function’s frame does not have.