def bin_scores(xs, ys, borders, reducer=np.nanmean):
    order = np.argsort(xs)
    (xs, ys) = (xs[order], ys[order])
    binned = []
    with warnings.catch_warnings():
        warnings.simplefilter('ignore', category=RuntimeWarning)
        for (start, stop) in zip(borders[:(- 1)], borders[1:]):
            left = (xs <= start).sum()
            right = (xs <= stop).sum()
            binned.append(reducer(ys[left:right]))
    return (borders[1:], np.array(binned))
def bin_scores(xs, ys, borders, reducer=np.nanmean):
    order = np.argsort(xs)
    (xs, ys) = (xs[order], ys[order])
    binned = []
    with warnings.catch_warnings():
        warnings.simplefilter('ignore', category=RuntimeWarning)
        for (start, stop) in zip(borders[:(- 1)], borders[1:]):
            left = (xs <= start).sum()
            right = (xs <= stop).sum()
            binned.append(reducer(ys[left:right]))
    return (borders[1:], np.array(binned))