Skip to content

ValueNotPresentWhenFittedError

Bases: Exception

Exception raised when attempting to one-hot-encode a table containing values not present in the fitting phase.

Source code in src/safeds/exceptions/_data.py
class ValueNotPresentWhenFittedError(Exception):
    """Exception raised when attempting to one-hot-encode a table containing values not present in the fitting phase."""

    def __init__(self, values: list[tuple[str, str]]) -> None:
        values_info = [f"{value} in column {column}" for value, column in values]
        line_break = "\n"
        super().__init__(
            (
                "Value(s) not present in the table the transformer was fitted on:"
                f" {line_break}{line_break.join(values_info)}"
            ),
        )

__init__(values)

Source code in src/safeds/exceptions/_data.py
def __init__(self, values: list[tuple[str, str]]) -> None:
    values_info = [f"{value} in column {column}" for value, column in values]
    line_break = "\n"
    super().__init__(
        (
            "Value(s) not present in the table the transformer was fitted on:"
            f" {line_break}{line_break.join(values_info)}"
        ),
    )