Loading...

vastorbit.VastColumn.slice

VastColumn.slice(length: int, unit: str = 'second', start: bool = True) VastFrame

Slices and transforms the VastColumn using a time series rule.

Parameters:
  • length (int) – Slice size.

  • unit (str, optional) – Slice size unit. Options: ‘second’, ‘minute’, ‘hour’, ‘day’, ‘week’, ‘month’, ‘quarter’, ‘year’

  • start (bool, optional) – If set to True, the record is sliced using the floor of the slicing (start of period).

Returns:

self._parent

Return type:

VastFrame

Examples

import vastorbit as vo

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

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

# Slice into 30 minute intervals
vdf["time"].slice(30, "minute")

See also

VastColumn.date_part() : Extracts a specific TS field from the VastColumn.