polars_online.WrongTypeError

class polars_online.WrongTypeError[source]

Bases: TypeError, ValueError

The error raised for a value of the wrong type where ValueError was raised before.

The value may be a float where a whole number is needed, one spec where a list of them is, a text column where a number is, or a UInt128 column, which polars-online cannot read. It is a TypeError, the class for a value of the wrong type, and a ValueError too, the class most of these refusals raised before. The ValueError parent is dropped at the next major version, so catch TypeError.

Examples

spec = po.spec.ewridge("m", targets=["y"], features=["x0"], half_life=50.0)
try:
    po.ModelBank(spec)                   # one spec, not a list of them
except TypeError as e:   # or ValueError, until then
    print(type(e).__name__, str(e).split(".")[0])
WrongTypeError ModelBank: specs must be a list of specs, but it is one spec

See also