def percent_close_to_median(x, window_frac=0.1):
    window = (x.max() - x.min()) * window_frac
    return np.mean(np.abs(x - np.median(x)) < window)
Percentage of values within window_frac*(max(x)-min(x)) of median.
dataset/ETHPy150Open cesium-ml/cesium/cesium/science_features/common_functions.py/percent_close_to_median