InvertibleTableTransformer
Bases: TableTransformer
, ABC
A TableTransformer
that can also undo the learned transformation after it has been applied.
Source code in src/safeds/data/tabular/transformation/_invertible_table_transformer.py
is_fitted: bool
¶
Whether the transformer is fitted.
fit
¶
Learn a transformation for a set of columns in a table.
Note: This transformer is not modified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
Table
|
The table used to fit the transformer. |
required |
Returns:
Name | Type | Description |
---|---|---|
fitted_transformer |
Self
|
The fitted transformer. |
Source code in src/safeds/data/tabular/transformation/_table_transformer.py
fit_and_transform
¶
Learn a transformation for a set of columns in a table and apply the learned transformation to the same table.
Note: Neither this transformer nor the given table are modified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
Table
|
The table used to fit the transformer. The transformer is then applied to this table. |
required |
Returns:
Name | Type | Description |
---|---|---|
fitted_transformer |
Self
|
The fitted transformer. |
transformed_table |
Table
|
The transformed table. |
Source code in src/safeds/data/tabular/transformation/_table_transformer.py
inverse_transform
¶
Undo the learned transformation as well as possible.
Column order and types may differ from the original table. Likewise, some values might not be restored.
Note: The given table is not modified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
transformed_table |
Table
|
The table to be transformed back to the original version. |
required |
Returns:
Name | Type | Description |
---|---|---|
original_table |
Table
|
The original table. |
Raises:
Type | Description |
---|---|
TransformerNotFittedError
|
If the transformer has not been fitted yet. |
Source code in src/safeds/data/tabular/transformation/_invertible_table_transformer.py
transform
¶
Apply the learned transformation to a table.
Note: The given table is not modified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table |
Table
|
The table to which the learned transformation is applied. |
required |
Returns:
Name | Type | Description |
---|---|---|
transformed_table |
Table
|
The transformed table. |
Raises:
Type | Description |
---|---|
TransformerNotFittedError
|
If the transformer has not been fitted yet. |