Extract date component¶
fast step date & time
Extract a component such as day, week, weekday etc. from a date column.
The type of the output column depends on the component extracted. Where the component is a name (e.g. of the day of week), the result will be a categorical column. Otherwise it will be numeric.
Usage¶
The following are the step's expected inputs and outputs and their specific types.
extract_date_component(date: date, {"param": value}) -> (component: column)
where the object {"param": value}
is optional in most cases and if present may contain any of the parameters described in the
corresponding section below.
Example¶
To extract the number of the month (1..12) from a date column:
extract_date_component(ds.date, {"component": "month"}) -> (ds.month)
Inputs¶
date: column:date
A column of dates to extract the desired component from.
Outputs¶
component: column
A numeric or categorical column containing the desired component.
Parameters¶
component: string = "day"
The name of the date component to extract.
Must be one of:
"date"
,
"day"
,
"day_name"
,
"dayofmonth"
,
"dayofweek"
,
"dayofyear"
,
"hour"
,
"minute"
,
"month"
,
"month_name"
,
"part_of_day"
,
"partofday"
,
"period_of_day"
,
"periodofday"
,
"quarter"
,
"season"
,
"second"
,
"time"
,
"week"
,
"weekday"
,
"weekday_name"
,
"weekofyear"
,
"year"