vastorbit.VastFrame.between¶
- VastFrame.between(column: str, start: Annotated[bool | float | str | timedelta | datetime, 'Python Scalar'] | None = None, end: Annotated[bool | float | str | timedelta | datetime, 'Python Scalar'] | None = None, inplace: bool = True) VastFrame¶
Filters the VastFrame by only keeping the records between two input elements.
- Parameters:
column (str) – TS (Time Series) VastColumn used to filter the data. The VastColumn type must be date (date, datetime, timestamp…)
start (PythonScalar, optional) – Input Python Scalar used to filter.
end (PythonScalar, optional) – Input Python Scalar used to filter.
inplace (bool, optional) – If set to True, the filtering is applied to the VastFrame.
- Returns:
self
- Return type:
Examples
We import
vastorbit:import vastorbit as vo
Hint
By assigning an alias to
vastorbit, we mitigate the risk of code collisions with other libraries. This precaution is necessary because vastorbit uses commonly known function names like “average” and “median”, which can potentially lead to naming conflicts. The use of an alias ensures that the functions fromvastorbitare used as intended without interfering with functions from other libraries.For this example, we will use a dummy time-series data:
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.], } )["time"].astype("timestamp")
📅timeTimestamp(3)123valDecimal(2, 1)1 1993-11-01 00:00:00 0.0 2 1993-11-03 00:00:00 2.0 3 1993-11-04 00:00:00 4.0 4 1993-11-02 00:00:00 1.0 5 1993-11-05 00:00:00 5.0 Rows: 1-5 | Columns: 2Note
vastorbit offers a wide range of sample datasets that are ideal for training and testing purposes. You can explore the full list of available datasets in the Datasets, which provides detailed information on each dataset and how to use them effectively. These datasets are invaluable resources for honing your data analysis and machine learning skills within the vastorbit environment.
Using
betweenwe can easily filter through time-series values:vdf.between(column = "time", start = "1993-11-02", end = "1993-11-04")
📅timeTimestamp(3)123valDecimal(2, 1)1 1993-11-03 00:00:00 2.0 2 1993-11-04 00:00:00 4.0 3 1993-11-02 00:00:00 1.0 Rows: 3 | Columns: 2