Decompose Datetime

Extracts parts of a timestamp from a specified timestamp column to new columns. For example: given the timestamp column 'Birthdate' when extracting the year part, a new column named year of type Numeric will be created.

If the value for parameter prefix is provided it will be prepended to the generated columns’ names, according to the pattern: prefix + timestampPartName.

Also returns a Transformer that can be later applied to another DataFrame with a Transform operation.

Since: Seahorse 0.4.0

Input

Port Type Qualifier Description
0 DataFrame The DataFrame with the timestamp column to decompose.

Output

Port Type Qualifier Description
0 DataFrame The DataFrame with new columns with parts of timestamp extracted from the original timestamp column.
1 Transformer The transformer that allows to apply the operation on another DataFrame using a Transform.

Parameters

Name Type Description
timestamp column SingleColumnSelector One of the DataFrame columns. If the column selected by the user has a type other than Timestamp, WrongColumnTypeException will be thrown. If the selected column does not exist, a ColumnDoesNotExistException will be thrown.
parts MultipleChoice Parts of timestamp to extract to new columns. Possible values are: [year, month, day, hour, minutes, seconds].
prefix String An optional prefix for the created columns. If provided, names of the generated columns will match the prefix + timestampPartName pattern, otherwise names will match the timestampPartName pattern.

Example

Input data

Name Birthdate
Jim Morrison 1943-12-08 13:47:16
Jimmy Page 1944-01-09 08:35:10

Operation params

Parameter Value
timestamp column Name
parts [year, month, day]

Output data

Name Birthdate year month day
Jim Morrison 1943-12-08 13:47:16 1943 12 8
Jimmi Page 1944-01-09 08:35:10 1944 1 9

Operation params

Parameter Value
timestamp column Name
parts [year, month, day]
prefix "Birthdate_"

Output data

Name Birthdate Birthdate_year Birthdate_month Birthdate_day
Jim Morrison 1943-12-08 13:47:16 1943 12 8
Jimmi Page 1944-01-09 08:35:10 1944 1 9