Loading...

vastorbit.VastFrame.last

VastFrame.last(ts: str, offset: str) VastFrame

Filters the VastFrame by only keeping the last records.

Parameters:
  • ts (str) – TS (Time Series) VastColumn used to filter the data. The VastColumn type must be date (date, datetime, timestamp…)

  • offset (str) – Interval offset. For example, to filter and keep only the last 6 months of records, offset should be set to ‘6 months’. Format: ‘1 day’, ‘6 months’, ‘2 hours’, etc.

Returns:

self

Return type:

VastFrame

Examples

import vastorbit as vo

vdf = vo.VastFrame({
    "time": [
        "1993-11-01",
        "1993-11-02",
        "1993-11-03",
        "1993-11-04",
        "1993-11-05",
    ],
    "val": [0., 1., 2., 4., 5.],
})

vdf["time"].astype("timestamp")

# Keep last 1 day of records
vdf.last(ts="time", offset="1 day")

See also

VastFrame.first() : Filters the VastFrame by only keeping the first records.
VastFrame.at_time() : Filters the VastFrame at a specific time.