Last active
December 3, 2016 21:24
-
-
Save joeleonjr/30d50b2b6d0830be26e0cd1898faac0a 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 collections | |
import matplotlib | |
matplotlib.use('TkAgg') | |
import matplotlib.pyplot as plt | |
import matplotlib.mlab as mlab | |
import scipy.stats as stats | |
data = [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(data) | |
count_sum = sum(c.values()) | |
for k, v in c.items(): | |
print('The relative frequency of number ' + str(k) + ' is ' + str(float(v) / count_sum) + '. The absolute frequency is ' + str(v) + ". ") | |
plt.figure(1) | |
plt.boxplot(data) | |
plt.savefig('boxplot.png') | |
plt.figure(2) | |
plt.hist(data, histtype='bar') | |
plt.savefig('histogram.png') | |
plt.figure(3) | |
prob_plot = stats.probplot(data, dist='norm', plot=plt) | |
plt.savefig('probability_plot.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment