ewoksxas.converters.orange.Column#

class ewoksxas.converters.orange.Column(*, name, data, var_type, values=<factory>, attributes=<factory>, kwargs=<factory>)[source]#

Bases: object

A single named meta/target column together with its Orange variable type.

For a DiscreteVariable column data holds integer category indices and values holds the ordered category labels those indices point into. For ContinuousVariable and StringVariable columns values is empty.

Attributes:

name: Name of the column. data: Underlying NumPy array (category indices for discrete columns). var_type: Orange variable class associated with the column. values: Ordered categorical labels (discrete columns only). kwargs: Extra keyword arguments forwarded to the Orange variable.

Parameters:
  • name (str)

  • data (ndarray[tuple[int, ...], dtype[Any]])

  • var_type (VarType)

  • values (list[str])

  • attributes (dict[str, Any])

  • kwargs (dict[str, Any])

attributes: dict[str, Any]#
concatenate(*others, role)[source]#
Parameters:
Return type:

Column

data: ndarray[tuple[int, ...], dtype[Any]]#
classmethod from_data(name, data, var_type, *, role, attributes=None, **kwargs)[source]#

Resolve the variable type, validate it for the role, and encode the data.

Raises:

ValueError: if var_type and role are incompatible. ValueError: if var_type is ContinuousVariable and data is not numeric.

Parameters:
  • name (str)

  • data (ndarray[tuple[int, ...], dtype[Any]])

  • var_type (VarType)

  • role (Role)

  • attributes (dict[str, str] | None)

  • kwargs (Any)

Return type:

Column

classmethod from_variable(var, data, *, role)[source]#

Rebuild a column from an Orange Variable and its raw table data.

Raises:
ValueError: Propagated from from_data when the table data is

inconsistent with the variable (e.g. a missing categorical value, or a non-numeric ContinuousVariable).

Parameters:
  • var (Variable)

  • data (ndarray[tuple[int, ...], dtype[Any]])

  • role (Role)

Return type:

Column

get_decoded_data()[source]#

Return user-facing data: labels for discrete columns, else raw data.

Return type:

ndarray[tuple[int, ...], dtype[Any]]

property is_categorical: bool#

Whether the column has VarType.CATEGORICAL as its self.var_type.

is_compatible(column)[source]#
Parameters:

column (Column)

Return type:

bool

property is_numeric: bool#

Whether the column has VarType.NUMERIC as its self.var_type.

property is_text: bool#

Whether the column has VarType.TEXT as its self.var_type.

kwargs: dict[str, Any]#
name: str#
take_rows(indices)[source]#

Return an independent copy of the column with only the given rows.

Args:

indices: Row positions to keep, in the desired output order.

Parameters:

indices (Sequence[int])

Return type:

Column

to_object_array()[source]#

Return the data as an object array (preserves types when stacked).

Return type:

ndarray[tuple[int, ...], dtype[Any]]

to_variable()[source]#

Build the Orange Variable for this column.

Return type:

Variable

values: list[str]#
var_type: VarType#