get_extreme_outlier_bounds

pyhelpers.ops.get_extreme_outlier_bounds(num_dat, k=1.5)

Get upper and lower bounds for extreme outliers.

Parameters
  • num_dat (array-like) – an array of numbers

  • k (float, int) – a scale coefficient associated with interquartile range, defaults to 1.5

Returns

lower and upper bound

Return type

tuple

Examples:

>>> from pyhelpers.ops import get_extreme_outlier_bounds
>>> import pandas

>>> data = pandas.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)