get_extreme_outlier_bounds

pyhelpers.ops.get_extreme_outlier_bounds(num_dat, k=1.5)[source]

Get the upper and lower bounds for extreme outliers using the interquartile range method.

Parameters:
  • num_dat (array-like) – Array-like object containing numerical data.

  • k (float | int) – Scale coefficient associated with the interquartile range; defaults to 1.5.

Returns:

Tuple containing the lower and upper bounds for extreme outliers.

Return type:

tuple

Examples:

>>> from pyhelpers.ops import get_extreme_outlier_bounds
>>> import pandas as pd
>>> data = pd.DataFrame(range(100), columns=['col'])
>>> data
    col
0     0
1     1
2     2
3     3
4     4
..  ...
95   95
96   96
97   97
98   98
99   99
[100 rows x 1 columns]
>>> data.describe()
              col
count  100.000000
mean    49.500000
std     29.011492
min      0.000000
25%     24.750000
50%     49.500000
75%     74.250000
max     99.000000
>>> lo_bound, up_bound = get_extreme_outlier_bounds(data, k=1.5)
>>> lo_bound, up_bound
(0.0, 148.5)