8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 45a7e89 commit a0febcfCopy full SHA for a0febcf
data-science/statistics.py
@@ -0,0 +1,25 @@
1
+from collections import Counter
2
+from matplotlib import pyplot as plt
3
+import random
4
+
5
6
+def friend_hist():
7
+ num_friends = [random.randint(1, 120) for _ in range(1025)]
8
9
+ friend_counts = Counter(num_friends)
10
+ xs = range(101) # largest value is 100
11
+ ys = [friend_counts[x] for x in xs] # height is just # of friends
12
+ plt.bar(xs, ys)
13
+ plt.axis([0, 101, 0, 25])
14
+ plt.title("Histogram of Friend Counts")
15
+ plt.xlabel("# of friends")
16
+ plt.ylabel("# of people")
17
+ plt.show()
18
19
20
+def main():
21
+ friend_hist()
22
23
24
+if __name__ == '__main__':
25
+ main()
0 commit comments