Projection
Creates a new DataFrame that contains only the selected columns.
The order of the columns is specified by user.
Each column can be optionally renamed.
Each column can be selected many times,
but in the resulting DataFrame
column names cannot be duplicated.
Also returns a Transformer that can be later applied
to another DataFrame
with a Transform operation.
Since: Seahorse 1.2.0
Port |
Type Qualifier |
Description |
0 |
DataFrame |
The DataFrame to select columns from. |
Output
Port |
Type Qualifier |
Description |
0 |
DataFrame |
The DataFrame containing the selected columns (and only them). |
1 |
Transformer |
The Transformer that allows to apply the operation on other DataFrames
using the Transform. |
Parameters
Name |
Type |
Description |
projection columns |
Parameters Sequence |
The sequence of column projection descriptions
(original column: SingleColumnSelector ,
rename column: Single Choice - possible values: ["No", "Yes"] ,
column name: String
- valid only if rename column is set to "Yes" )
defining the selection, order and optionally new names of columns.
When a column selected by name or by index does not exist, ColumnDoesNotExistException is thrown.
|
Example
Parameters
Name |
Value |
projection columns |
Select columns: price , city , city (renamed to location ) |
city |
beds |
price |
CityA |
4.0 |
695611.0 |
CityC |
2.0 |
294691.0 |
CityB |
3.0 |
430784.0 |
CityB |
2.0 |
336677.0 |
CityA |
3.0 |
584639.0 |
CityA |
4.0 |
579560.0 |
Output
price |
city |
location |
695611.0 |
CityA |
CityA |
294691.0 |
CityC |
CityC |
430784.0 |
CityB |
CityB |
336677.0 |
CityB |
CityB |
584639.0 |
CityA |
CityA |
579560.0 |
CityA |
CityA |