def pdf2(values, bins):
    '\n    The ~ PDF normalized so that\n    the integral is equal to the\n    total amount of a quantity.\n    The integral over a range is the\n    total amount within that range.\n\n    Returns array of size len(bins)-1\n    Plot versus bins[:-1]\n    '
    if hasattr(bins, '__getitem__'):
        range = (np.nanmin(bins), np.nanmax(bins))
    else:
        range = None
    (pdf, x) = np.histogram(values, bins=bins, range=range, density=False)
    pdf = (pdf.astype(float) / np.diff(x))
    return (pdf, avg(x))
The ~ PDF normalized so that
the integral is equal to the
total amount of a quantity.
The integral over a range is the
total amount within that range.

Returns array of size len(bins)-1
Plot versus bins[:-1]
def pdf2(values, bins):
    '\n    The ~ PDF normalized so that\n    the integral is equal to the\n    total amount of a quantity.\n    The integral over a range is the\n    total amount within that range.\n\n    Returns array of size len(bins)-1\n    Plot versus bins[:-1]\n    '
    if hasattr(bins, '__getitem__'):
        range = (np.nanmin(bins), np.nanmax(bins))
    else:
        range = None
    (pdf, x) = np.histogram(values, bins=bins, range=range, density=False)
    pdf = (pdf.astype(float) / np.diff(x))
    return (pdf, avg(x))