timecol
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| NodeSource datacook.engine.timecol What `time_column()` needs of a session (`Session`, the app's session protocol). |
🛈 DocStrings¶
The time column of a step: which column is "the time" (replaces the old DatetimeIndex).
Frames have no meaningful index in the engine: time is an ordinary column. Time series ops
name it in a param marked with the UI hint TIME_COLUMN ({"widget": "column", "role":
"time"}), so the generated code stays explicit (df.resample("1min", on="time")).
Which column that is, is recorded in the steps themselves, not in hidden node metadata, so it survives project files, recipes and code edits:
- the nearest step on the path to the node (the node itself first, then its first parents) with a time-role param ("Use as time column", "Resample", ...) whose column still exists;
- else the first column with a date / time dtype.
The app pre-fills time-role fields of a new step with time_column(session, input_id).
TIME_COLUMN
module-attribute
¶
json_schema_extra of a param holding the time column.
NodeSource
¶
Bases: Protocol
What time_column() needs of a session (Session, the app's session protocol).
Source code in src/datacook/engine/timecol.py
infer
¶
is_datetime
¶
time_column
¶
time_column(session: NodeSource, node_id: str) -> str | None
The time column of the node's frame (see the module docstring); None if unknown.
Uses the node's summary when it was computed (to check the column still exists and to infer one); never computes anything.
Source code in src/datacook/engine/timecol.py
time_fields
¶
Names of the time-role fields of a params model.