ewoksxas.converters.orange.Column#
- class ewoksxas.converters.orange.Column(*, name, data, var_type, values=<factory>, attributes=<factory>, kwargs=<factory>)[source]#
Bases:
objectA single named meta/target column together with its Orange variable type.
For a
DiscreteVariablecolumndataholds integer category indices andvaluesholds the ordered category labels those indices point into. ForContinuousVariableandStringVariablecolumnsvaluesis 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]#
- 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.
- classmethod from_variable(var, data, *, role)[source]#
Rebuild a column from an Orange Variable and its raw table data.
- Raises:
- ValueError: Propagated from
from_datawhen the table data is inconsistent with the variable (e.g. a missing categorical value, or a non-numeric ContinuousVariable).
- ValueError: Propagated from
- 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.
- 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:
- to_object_array()[source]#
Return the data as an object array (preserves types when stacked).
- Return type:
ndarray[tuple[int,...],dtype[Any]]
- values: list[str]#