def cdf(values, bins):
    '\n    (statistical) cumulative distribution function\n    Integral on [-inf, b] is the fraction below b.\n    CDF is invariant to binning.\n    This assumes you are using the entire range in the binning.\n    Returns array of size len(bins)\n    Plot versus bins[:-1]\n    '
    if hasattr(bins, '__getitem__'):
        range = (np.nanmin(bins), np.nanmax(bins))
    else:
        range = None
    (h, bins) = np.histogram(values, bins=bins, range=range, density=False)
    c = np.cumsum((h / np.sum(h, dtype=float)))
    return (np.append(0, c), bins)
(statistical) cumulative distribution function
Integral on [-inf, b] is the fraction below b.
CDF is invariant to binning.
This assumes you are using the entire range in the binning.
Returns array of size len(bins)
Plot versus bins[:-1]
def cdf(values, bins):
    '\n    (statistical) cumulative distribution function\n    Integral on [-inf, b] is the fraction below b.\n    CDF is invariant to binning.\n    This assumes you are using the entire range in the binning.\n    Returns array of size len(bins)\n    Plot versus bins[:-1]\n    '
    if hasattr(bins, '__getitem__'):
        range = (np.nanmin(bins), np.nanmax(bins))
    else:
        range = None
    (h, bins) = np.histogram(values, bins=bins, range=range, density=False)
    c = np.cumsum((h / np.sum(h, dtype=float)))
    return (np.append(0, c), bins)