Skip to content

ExperimentalRow

Bases: ABC, Mapping[str, Any]

A one-dimensional collection of named, heterogeneous values.

This class cannot be instantiated directly. It is only used for arguments of callbacks.

Source code in src/safeds/data/tabular/containers/_experimental_row.py
class ExperimentalRow(ABC, Mapping[str, Any]):
    """
    A one-dimensional collection of named, heterogeneous values.

    This class cannot be instantiated directly. It is only used for arguments of callbacks.
    """

    # ------------------------------------------------------------------------------------------------------------------
    # Dunder methods
    # ------------------------------------------------------------------------------------------------------------------

    def __contains__(self, name: Any) -> bool:
        return self.has_column(name)

    @abstractmethod
    def __eq__(self, other: object) -> bool: ...

    def __getitem__(self, name: str) -> ExperimentalCell:
        return self.get_value(name)

    @abstractmethod
    def __hash__(self) -> int: ...

    def __iter__(self) -> Iterator[Any]:
        return iter(self.column_names)

    def __len__(self) -> int:
        return self.number_of_columns

    @abstractmethod
    def __sizeof__(self) -> int: ...

    # ------------------------------------------------------------------------------------------------------------------
    # Properties
    # ------------------------------------------------------------------------------------------------------------------

    @property
    @abstractmethod
    def column_names(self) -> list[str]:
        """The names of the columns in the row."""

    @property
    @abstractmethod
    def number_of_columns(self) -> int:
        """The number of columns in the row."""

    @property
    @abstractmethod
    def schema(self) -> ExperimentalSchema:
        """The schema of the row."""

    # ------------------------------------------------------------------------------------------------------------------
    # Column operations
    # ------------------------------------------------------------------------------------------------------------------

    @abstractmethod
    def get_value(self, name: str) -> ExperimentalCell:
        """
        Get the value of the specified column.

        Parameters
        ----------
        name:
            The name of the column.

        Returns
        -------
        value:
            The value of the column.
        """

    @abstractmethod
    def get_column_type(self, name: str) -> ExperimentalDataType:
        """
        Get the type of the specified column.

        Parameters
        ----------
        name:
            The name of the column.

        Returns
        -------
        type:
            The type of the column.
        """

    @abstractmethod
    def has_column(self, name: str) -> bool:
        """
        Check if the row has a column with the specified name.

        Parameters
        ----------
        name:
            The name of the column.

        Returns
        -------
        has_column:
            Whether the row has a column with the specified name.
        """

column_names: list[str] abstractmethod property

The names of the columns in the row.

number_of_columns: int abstractmethod property

The number of columns in the row.

schema: ExperimentalSchema abstractmethod property

The schema of the row.

get_column_type(name) abstractmethod

Get the type of the specified column.

Parameters:

Name Type Description Default
name str

The name of the column.

required

Returns:

Name Type Description
type ExperimentalDataType

The type of the column.

Source code in src/safeds/data/tabular/containers/_experimental_row.py
@abstractmethod
def get_column_type(self, name: str) -> ExperimentalDataType:
    """
    Get the type of the specified column.

    Parameters
    ----------
    name:
        The name of the column.

    Returns
    -------
    type:
        The type of the column.
    """

get_value(name) abstractmethod

Get the value of the specified column.

Parameters:

Name Type Description Default
name str

The name of the column.

required

Returns:

Name Type Description
value ExperimentalCell

The value of the column.

Source code in src/safeds/data/tabular/containers/_experimental_row.py
@abstractmethod
def get_value(self, name: str) -> ExperimentalCell:
    """
    Get the value of the specified column.

    Parameters
    ----------
    name:
        The name of the column.

    Returns
    -------
    value:
        The value of the column.
    """

has_column(name) abstractmethod

Check if the row has a column with the specified name.

Parameters:

Name Type Description Default
name str

The name of the column.

required

Returns:

Name Type Description
has_column bool

Whether the row has a column with the specified name.

Source code in src/safeds/data/tabular/containers/_experimental_row.py
@abstractmethod
def has_column(self, name: str) -> bool:
    """
    Check if the row has a column with the specified name.

    Parameters
    ----------
    name:
        The name of the column.

    Returns
    -------
    has_column:
        Whether the row has a column with the specified name.
    """