fsspec_utils.utils.datetime API Reference¶
get_timestamp_column()¶
Parameters:
| Name | Type | Description |
|---|---|---|
df |
polars.DataFrame |
Input DataFrame. |
Example:
Returns:
None
get_timedelta_str()¶
Parameters:
| Name | Type | Description |
|---|---|---|
timedelta_string |
str |
Timedelta string (e.g., "1h", "2d", "3w"). |
Example:
| to | str | Defaults to 'polars' |
Returns:
None
timestamp_from_string()¶
Converts a timestamp string (ISO 8601 format) into a datetime, date, or time object
using only standard Python libraries. Handles strings with or without timezone information (e.g., '2023-01-01T10:00:00+02:00', '2023-01-01', '10:00:00'). Supports timezone offsets like '+HH:MM' or '+HHMM'. For named timezones (e.g., 'Europe/Paris'), requires Python 3.9+ and the 'tzdata' package to be installed.
Parameters:
| Name | Type | Description |
|---|---|---|
timestamp_str |
str |
The string representation of the timestamp (ISO 8601 format). |
tz |
str, optional |
Target timezone identifier (e.g., 'UTC', '+02:00', 'Europe/Paris'). If provided, the output datetime/time will be localized or converted to this timezone. Defaults to None. |
naive |
bool, optional |
If True, return a naive datetime/time (no timezone info), even if the input string or tz parameter specifies one. Defaults to False. |
Returns:
Union[dt.datetime, dt.date, dt.time]: The parsed datetime, date, or time object.
Example:
Raises:
ValueError: If the timestamp string format is invalid or the timezone is invalid/unsupported.