HTML
¶os.getcwd()
babe = scm.imread("puppy.jpg")
plt.imshow(babe)
plt.show()
data_url = "http://kinetics.nist.gov/janaf/html/C-067.txt"
pd.read_csv(data_url, sep='\t').head()
Methane (CH4) | C1H4(g) | ||||||
---|---|---|---|---|---|---|---|
T(K) | Cp | S | -[G-H(Tr)]/T | H-H(Tr) | delta-f H | delta-f G | log Kf |
0 | 0. | 0. | INFINITE | -10.024 | -66.911 | -66.911 | INFINITE |
100 | 33.258 | 149.500 | 216.485 | -6.698 | -69.644 | -64.353 | 33.615 |
200 | 33.473 | 172.577 | 189.418 | -3.368 | -72.027 | -58.161 | 15.190 |
250 | 34.216 | 180.113 | 186.829 | -1.679 | -73.426 | -54.536 | 11.395 |
from scipy.stats import norm
x_norm = norm.rvs(size=500)
h = scp.histogram(x_norm, normed=True, bins=50)
# Print mean and standard deviation
print(norm.fit(x_norm))
plt.hist(x_norm, normed=True, bins=20)
x = np.linspace(-3,3,50)
plt.plot(x, norm.pdf(x), '.r-')
(-0.007462693515075159, 0.97944995438956184)
[<matplotlib.lines.Line2D at 0x1078bb810>]
# Compute probability that certain values
# lie between two endpoints.
from scipy.integrate import trapz
x1 = np.linspace(-3,3,100)
p = trapz(norm.pdf(x1), x1)
# plt.plot(x, norm.pdf(x), '-b.')
plt.plot(x, norm.pdf(x, loc=0, scale=1) )
plt.plot(x, norm.pdf(x, loc=0.5, scale=2) )
plt.plot(x, norm.pdf(x, loc=0.5, scale=0.5) )
[<matplotlib.lines.Line2D at 0x108facfd0>]
from scipy.stats import norm, ttest_ind, ttest_rel, ttest_1samp
n1 = norm(loc=0.3, scale=1.0)
n2 = norm(loc=0.0, scale=1.0)
n1_samples = n1.rvs(size=100)
n2_samples = n2.rvs(size=100)
samples = np.concatenate([n1_samples, n2_samples], axis=0)
loc, scale = norm.fit(samples)
n = norm(loc=loc, scale=scale)
x = np.linspace(-3, 3, 100)
h = plt.hist([n1_samples, n2_samples], normed=True)
plt.plot(x,n.pdf(x), 'b-')
plt.plot(x,n1.pdf(x), 'r-')
plt.plot(x,n2.pdf(x), 'k-')
[<matplotlib.lines.Line2D at 0x109223750>]