Expand
ExpandColumns
¶
Bases: Step
Expand columns that contain lists into multiple rows.
Attributes:
Name | Type | Description |
---|---|---|
columns |
Union[Dict[str, str], List[str]]
|
A dictionary that maps the column to be expanded to the new column name or a list of columns to be expanded. If a list is provided, the new column name will be the same as the column name. |
Input columns
- The columns to be expanded.
Output columns
- The expanded columns.
Source code in src/distilabel/steps/expand.py
inputs: List[str]
property
¶
The columns to be expanded.
outputs: List[str]
property
¶
The expanded columns.
always_dict(value)
classmethod
¶
Ensure that the columns are always a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
Union[Dict[str, str], List[str]]
|
The columns to be expanded. |
required |
Returns:
Type | Description |
---|---|
Dict[str, str]
|
The columns to be expanded as a dictionary. |
Source code in src/distilabel/steps/expand.py
process(inputs)
¶
Expand the columns in the input data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
StepInput
|
The input data. |
required |
Yields:
Type | Description |
---|---|
StepOutput
|
The expanded rows. |