Created
December 5, 2016 22:21
-
-
Save jmsword/8c9f4d20d88802e2db952283f6c516a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.stats as stats | |
import collections | |
import matplotlib.pyplot as plt | |
x = [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9] | |
c = collections.Counter(x) | |
count_sum = sum(c.values()) | |
for k,v in c.items(): | |
print("The frequency of number " + str(k) + " is " + str(float(v) / count_sum)) | |
plt.boxplot(x) | |
plt.savefig("boxplot.png") | |
plt.hist(x, histtype='bar') | |
plt.savefig("histogram.png") | |
plt.figure() | |
data = x | |
graph = stats.probplot(x, dist="norm", plot=plt) | |
plt.savefig("qqplot.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment