Timeframes
The atomic units underneath every calendar.
CORE_TIMEFRAMES
module-attribute
CORE_TIMEFRAMES = (
"YEAR",
"QUARTER",
"MONTH",
"MDAY",
"YDAY",
"HOUR",
"MINUTE",
"SECOND",
"WDAY",
"WHOUR",
"MWEEK",
"WEEK",
"SEASON",
"DAYTYPE",
"HOURTYPE",
)
as_timeframe
as_timeframe(
x: Any,
timeframe: str,
format: Literal["numeric", "token"] = "numeric",
**kwargs: Any,
) -> list
Read one timeframe off datetimes, timeslice labels, or numbers.
- datetimes: the field in the datetimes' time zone (
week_start=for WDAY/MWEEK); - timeslice labels: read from
calendar=(a Calendar or a name) by a join, never by parsing the label text;year=for the weekday-derived timeframes; - numbers:
format="token"spells them with the calendar's vocabulary (calendar=) or the canonical formatter.