Saltar al contenido principal

ColumnConcat

Converter
DashAI.back.converters.simple_converters.ColumnConcat

Concatenate the selected string columns into a new column.

Joins the columns selected in scope element-wise. Select two columns to concatenate them together, or one column to concatenate it with a fixed constant string. With two columns the order is <first column> + <second column> in dataset order, which can be reversed with swap_operands. An optional separator is inserted between the operands (none by default, e.g. "foo" + "bar" -> "foobar"). All selected columns must be Text or Categorical. If either operand is missing (None) for a row, the result for that row is None.

The original columns are left untouched; the result is appended as a new Text column named output_column_name, or, if not provided, <column_a>_concat_<column_b> or <column_a>_concat_<constant>.

Parameters

constant, default=None
Fixed string used as the second operand. Only used (and required) when a single column is selected.
separator, default=None
Optional string inserted between the two operands. If null, they are joined directly with no separator.
swap_operands : boolean, default=False
When two columns are selected, swap the concatenation order. By default it is 'first column' + 'second column' (in dataset order); enable this to concatenate 'second' + 'first' instead.
output_column_name, default=None
Name of the resulting column. If null, a name is generated from the operands.

Methods

fit(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> 'ColumnConcat'

Defined on ColumnConcat

Derive the operands from scope and validate them.

Parameters

x : DashAIDataset
The scoped dataset, expected to contain one or two columns.
y : DashAIDataset, optional
Ignored. Defaults to None.

Returns

ColumnConcat
The fitted converter instance (self).

get_output_type(self, column_name: str = None) -> DashAI.back.types.dashai_data_type.DashAIDataType

Defined on ColumnConcat

Return the output type for the concatenation result.

Parameters

column_name : str, optional
Not used; the result column always has the same type. Defaults to None.

Returns

DashAIDataType
A Text type backed by pyarrow.string().

transform(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> 'DashAIDataset'

Defined on ColumnConcat

Concatenate the operands and append the result as a new column.

Parameters

x : DashAIDataset
The dataset containing the operand column(s) derived during fit.
y : DashAIDataset, optional
Ignored. Defaults to None.

Returns

DashAIDataset
The original dataset with the concatenated result appended as a new Text column.

get_metadata(cls) -> 'Dict[str, Any]'

Defined on BaseConverter

Get metadata for the converter, used by the DashAI frontend.

Parameters

cls : type
The converter class (injected automatically by Python for classmethods).

Returns

Dict[str, Any]
Dictionary containing display name, short description, image preview path, category, icon, color, and whether the converter is supervised.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.