Loading...

vastorbit.VastColumn.drop_outliers

VastColumn.drop_outliers(threshold: Annotated[int | float | Decimal, 'Python Numbers'] = 4.0, use_threshold: bool = True, alpha: Annotated[int | float | Decimal, 'Python Numbers'] = 0.05) VastFrame

Drops outliers in the VastColumn.

Parameters:
  • threshold (PythonNumber, optional) – Uses the Gaussian distribution to identify outliers. After normalizing the data (Z-Score), if the absolute value of the record is greater than the threshold, it is considered as an outlier.

  • use_threshold (bool, optional) – Uses the threshold instead of the ‘alpha’ parameter.

  • alpha (PythonNumber, optional) – Number representing the outliers threshold. Values less than quantile(alpha) or greater than quantile(1-alpha) are be dropped.

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 knowvDC_dropn 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 data that has one outlier:

vdf = vo.VastFrame({"vals": [20, 10, 0, -20, 10, 20, 1200]})
123
vals
Integer
120
2-20
310
40
51200
610
720
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.

Using drop_outliers we can take out all the outliers in that column:

vdf["vals"].drop_outliers(threshold = 1.0)
123
vals
Integer
10
2-20
310
420
510
620
Rows: 6 | Column: vals | Type: integer

Note

By providing a custom threshold value, can have more control on the treatment of outliers.

See also

VastColumn.drop() : Drops the input VastColumn.
VastFrame.drop_duplicates() : Drops the VastFrame duplicates.