Histogram example

In [1]:
import pandas as pd
store = pd.HDFStore('/Volumes/FreshBooks/data/store.h5')
may07 = store['may07']
In [2]:
# bins is all the edges of the bins
# e.g. bins = [1, 2, 3, 4] defines the ranges
# [1,2), [2,3), and [3,4]
bins = [2**x for x in range(-10, 10)]
In [3]:
xscale('log')
xlim((bins[0], bins[-1]))
xlabel('Response time (s)')
ylabel('# of requests that took that long')

hist(may07['elapsed'], bins=bins)
Out[3]:
(array([     0,     24, 187141, 347874, 488751, 529416, 160609,  96496,
        34292,  14574,   9848,  20565,    969,    237,     77,     56,
            8,      0,      0]),
 array([  9.76562500e-04,   1.95312500e-03,   3.90625000e-03,
         7.81250000e-03,   1.56250000e-02,   3.12500000e-02,
         6.25000000e-02,   1.25000000e-01,   2.50000000e-01,
         5.00000000e-01,   1.00000000e+00,   2.00000000e+00,
         4.00000000e+00,   8.00000000e+00,   1.60000000e+01,
         3.20000000e+01,   6.40000000e+01,   1.28000000e+02,
         2.56000000e+02,   5.12000000e+02]),
 <a list of 19 Patch objects>)