add_datetime_features
Public callable
Add localized datetime feature columns derived from a UTC datetime column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
Any
|
Input pandas or Spark DataFrame. |
required |
datetime_column
|
str
|
Source UTC datetime column. |
required |
prefix
|
str | None
|
Prefix used for output columns. When omitted, |
None
|
timezone
|
str
|
IANA timezone used for localization. |
"Asia/Singapore"
|
include_datetime
|
bool
|
Whether to add |
True
|
include_date
|
bool
|
Whether to add |
True
|
include_time
|
bool
|
Whether to add |
True
|
include_hour
|
bool
|
Whether to add |
True
|
include_30_min_block
|
bool
|
Whether to add |
True
|
engine
|
str
|
Execution engine ( |
"auto"
|
Returns:
| Type | Description |
|---|---|
Any
|
DataFrame with requested datetime features. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> import pandas as pd
>>> df = pd.DataFrame({"event_ts": ["2026-01-01T00:45:00Z"]})
>>> add_datetime_features(df, "event_ts", prefix="EVENT")["EVENT_TIME_UTC8"].iloc[0]
'08:45:00'
Source code in src/fabricops_kit/technical_columns.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |