interquartile_range¶
- pyhelpers.ops.interquartile_range(num_dat)[source]¶
Calculate the interquartile range (IQR) of numerical data.
This function can serve as an alternative to scipy.stats.iqr.
- Parameters:
num_dat (numpy.ndarray | list | tuple) – Array-like object containing numerical data.
- Returns:
Interquartile range of num_dat.
- Return type:
float
Examples:
>>> from pyhelpers.ops import interquartile_range >>> data = list(range(100)) >>> iqr_result = interquartile_range(data) >>> iqr_result 49.5