In [6]:
import pandas

%matplotlib inline
dt = pandas.read_csv('../detroit_response_time.csv')
dt['Total_Trav'].describe()


Out[6]:
count    378927.000000
mean          3.206186
std           1.393627
min           0.000085
25%           2.211618
50%           3.066299
75%           4.051381
max          15.533279
Name: Total_Trav, dtype: float64

In [ ]:
import pandas
%matplotlib inline
dt = pandas.read_csv('../arlington_response_time.csv')
dt['Total_Trav'].hist()

In [10]:
dt['Total_Trav'].describe()


Out[10]:
count    42468.000000
mean         2.269506
std          1.157798
min          0.000050
25%          1.453490
50%          2.047223
75%          2.966185
max         14.610306
Name: Total_Trav, dtype: float64

In [11]:
from scipy.stats import lognorm
import numpy as np
import matplotlib.pyplot as plt

# Use this to get the tuple shape, location, and scale.
samp = lognorm.fit(dt['Total_Trav'])
print samp
lognorm.rvs(*samp)

x = np.linspace(0, 14, 1000)
pdf_fitted = lognorm.pdf(x, samp[0], loc=samp[1], scale=samp[2])

#dt['Total_Trav'].hist(normed=True)
fig, ax = plt.subplots(1,1)

plt.plot(x, pdf_fitted, 'r-')
plt.hist(dt['Total_Trav'], normed=True)


(0.3381962232249362, -1.0844073333047395, 3.1682731892016429)
Out[11]:
(array([  1.72917762e-01,   3.34876062e-01,   1.43875186e-01,
          2.97033681e-02,   2.35306117e-03,   3.86804576e-04,
          9.67011441e-05,   1.61168573e-05,   8.05842867e-05,
          1.45051716e-04]),
 array([  4.95214500e-05,   1.46107513e+00,   2.92210075e+00,
          4.38312636e+00,   5.84415197e+00,   7.30517758e+00,
          8.76620320e+00,   1.02272288e+01,   1.16882544e+01,
          1.31492800e+01,   1.46103056e+01]),
 <a list of 10 Patch objects>)

In [28]:



Out[28]:
[<matplotlib.lines.Line2D at 0x10c4bfe90>]

In [44]:



Out[44]:
array([ 3.03124682,  2.04705775,  3.21774143,  1.26956519,  0.60394629,
        1.94295309,  1.89466674,  2.67756875,  2.0818955 ,  2.46403248,
        0.91741141,  1.74855655,  0.94201519,  1.4943771 ,  1.84304305,
        2.63310573,  2.2699538 ,  2.38579563,  1.13980838,  0.5480349 ,
        2.96801876,  1.0816029 ,  1.88923851,  0.70272875,  2.74531226,
        4.12089069,  0.49841054,  4.68517908,  5.520114  ,  1.91641424,
        2.27653655,  0.60085396,  1.26972805,  1.64900988,  2.62030648,
        3.87726606,  2.38139879,  1.72763128,  1.87205235,  3.37362538,
        2.58104706,  1.38247128,  0.78499754,  4.40004001,  1.24140766,
        1.51571865,  1.24452253,  1.44235881,  1.23951104,  1.9050204 ])