vastorbit.VastColumn.clip¶
- VastColumn.clip(lower: Annotated[bool | float | str | timedelta | datetime, 'Python Scalar'] | None = None, upper: Annotated[bool | float | str | timedelta | datetime, 'Python Scalar'] | None = None) VastFrame¶
Clips the VastColumn by transforming the values less than the lower bound to the lower bound value and the values higher than the upper bound to the upper bound value.
- Parameters:
lower (PythonScalar, optional) – Lower bound.
upper (PythonScalar, optional) – Upper bound.
- Returns:
self._parent
- 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({"vals": [-20, -10, 0, -20, 10, 20, 120]})
123valsInteger1 0 2 -10 3 10 4 20 5 120 6 -20 7 -20 Rows: 1-7 | Column: vals | Type: integerNote
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.
We can see that there are some extreme values in the data. We may need to clip those values at extremes. For this we can use the
clipfunction.vdf["vals"].clip(lower=0,upper=100)
123valsInteger1 0 2 100 3 20 4 0 5 0 6 0 7 10 Rows: 1-7 | Column: vals | Type: integerSee also
VastFrame.fillna(): Fill the missing values using the input method.VastColumn.fill_outliers(): Fill the outliers using the input method.