Loading...

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:

VastFrame

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 from vastorbit are 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]})
123
vals
Integer
10
2-10
310
420
5120
6-20
7-20
Rows: 1-7 | Column: vals | Type: integer

Note

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 clip function.

vdf["vals"].clip(lower=0,upper=100)
123
vals
Integer
10
2100
320
40
50
60
710
Rows: 1-7 | Column: vals | Type: integer

See also

VastFrame.fillna() : Fill the missing values using the input method.
VastColumn.fill_outliers() : Fill the outliers using the input method.