In [13]:
%matplotlib inline
from collections import Counter
import matplotlib.pyplot as plt
In [10]:
num_friends = [100,49,41,40,25,3,2,5,1,4,2,5,5,5,2,5,4,555,4,1,5,2,22]
friend_counts = Counter(num_friends)
friend_counts
Out[10]:
In [20]:
xs = range(101)
ys = [friend_counts[x] for x in xs]
plt.bar(xs, ys)
plt.axis([0, 101, 0, 25])
plt.title('Histogram of Friend Counter')
plt.xlabel('# of friends')
plt.ylabel('# of people')
plt.show()
In [21]:
num_points = len(num_friends)
largest_value = max(num_friends)
smallest_value = min(num_friends)
In [22]:
def mean(x):
return sum(x) / len(x)
mean(num_friends)
Out[22]:
In [ ]: