Converts types of columns in a DataFrame. One or more columns can be converted at the same time. Every selected column is converted to the same (selected) type.
Supports conversions from all types to String, Boolean, Timestamp, Double, Float, Long, and Integer type.
Every null
value stays a null
value in the result DataFrame
(despite the column type change).
When a Timestamp column is converted to Numeric, then each value is represented
by the number of milliseconds since 1 January 1970.
Boolean converted to String generates a column of true
and false
strings.
String column can be converted to Numeric only if all values in the column represent a numeric value.
A column converted to its type is not modified.
If one or more column can not be converted,
the operation will fail at runtime with a TypeConversionException
.
This operation also returns a Transformer that can be later applied to another DataFrame with Transform operation.
Since: Seahorse 0.4.0
Port | Type Qualifier | Description |
---|---|---|
0 |
DataFrame |
The DataFrame to select columns from. |
Port | Type Qualifier | Description |
---|---|---|
0 |
DataFrame |
The DataFrame with the converted columns. |
1 |
Transformer |
A Transformer that allows to apply the operation to other DataFrames
using a Transform. |
Name | Type | Description |
---|---|---|
target type |
Single Choice |
Target type of the conversion. Possible values are: [String, Boolean, Timestamp, Double, Float, Long,
Integer] . |
operate on |
InputOutputColumnSelector |
Input and output columns for the operation. |
Name | Value |
---|---|
target type |
int |
operate on |
one column |
input column |
"beds" |
output |
append new column |
output column |
"beds_int" |
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 |
city | beds | price | beds_int |
---|---|---|---|
CityA | 4.0 | 695611.0 | 4 |
CityC | 2.0 | 294691.0 | 2 |
CityB | 3.0 | 430784.0 | 3 |
CityB | 2.0 | 336677.0 | 2 |
CityA | 3.0 | 584639.0 | 3 |
CityA | 4.0 | 579560.0 | 4 |