# !cat page3.csv
Page 3 Results
Page 3
Shuffling the results
# !shuf --output=page3.csv <page3.csv
# !cat page3.csv
Since I ran this notebook more than once, the initial CSV is now completely lost…
Per-question results
Question 0 - preparing data
We will be reading the data here, and processing later..
import csv
import numpy as np
= []
results
with open('page3.csv') as csv_file:
= csv.reader(csv_file, delimiter=",")
csv_reader for row in csv_reader:
list(map(int, row)))
results.append(
= np.array(results) res_array
import matplotlib.pyplot as plt
def print_stats(A, bins = [x + 0.1 for x in range(-1,6)]):
print(f"Results: {A.tolist()}")
print(f"Mean: {np.mean(A)}")
print(f"Median: {np.median(A)}")
= np.unique(A, return_counts=True)
vals, counts print(f"Mode: {vals[np.argmax(counts)]} With count: {counts[np.argmax(counts)]}")
= bins, align='right') plt.hist(A, bins
Question 4
a.
1]) print_stats(res_array[:,:
Results: [[5], [5], [5], [4], [5], [5], [3], [5], [5], [5], [5], [5], [5], [5], [5], [5], [5], [5], [4], [5], [5], [5], [5], [4], [1], [5], [5], [5], [5], [5], [5], [5]]
Mean: 4.71875
Median: 5.0
Mode: 5 With count: 27
b.
1:2]) print_stats(res_array[:,
Results: [[5], [5], [5], [5], [4], [5], [1], [5], [5], [5], [5], [4], [5], [5], [5], [5], [4], [5], [3], [4], [3], [5], [5], [4], [1], [4], [4], [4], [5], [4], [5], [5]]
Mean: 4.34375
Median: 5.0
Mode: 5 With count: 19
c.
2:3], bins = [x + 0.1 for x in range(-1, 11)]) print_stats(res_array[:,
Results: [[5], [10], [5], [5], [5], [10], [2], [8], [5], [10], [8], [10], [8], [10], [10], [10], [5], [5], [10], [5], [7], [10], [5], [5], [0], [10], [10], [10], [10], [3], [10], [10]]
Mean: 7.375
Median: 8.0
Mode: 10 With count: 15
Page results
+ 0.1 for x in range(-1, 11)]) print_stats(res_array, [x
Results: [[5, 5, 5], [5, 5, 10], [5, 5, 5], [4, 5, 5], [5, 4, 5], [5, 5, 10], [3, 1, 2], [5, 5, 8], [5, 5, 5], [5, 5, 10], [5, 5, 8], [5, 4, 10], [5, 5, 8], [5, 5, 10], [5, 5, 10], [5, 5, 10], [5, 4, 5], [5, 5, 5], [4, 3, 10], [5, 4, 5], [5, 3, 7], [5, 5, 10], [5, 5, 5], [4, 4, 5], [1, 1, 0], [5, 4, 10], [5, 4, 10], [5, 4, 10], [5, 5, 10], [5, 4, 3], [5, 5, 10], [5, 5, 10]]
Mean: 5.479166666666667
Median: 5.0
Mode: 5 With count: 56
sum(res_array, axis=1), bins = [x + 0.1 for x in range(9,21)]) print_stats(np.
Results: [15, 20, 15, 14, 14, 20, 6, 18, 15, 20, 18, 19, 18, 20, 20, 20, 14, 15, 17, 14, 15, 20, 15, 13, 2, 19, 19, 19, 20, 12, 20, 20]
Mean: 16.4375
Median: 18.0
Mode: 20 With count: 10
After scaling
= lambda x: x + (20 - x) / 2
f
sum(res_array, axis=1)), bins = [x + 0.1 for x in range(9,21)]) print_stats(f(np.
Results: [17.5, 20.0, 17.5, 17.0, 17.0, 20.0, 13.0, 19.0, 17.5, 20.0, 19.0, 19.5, 19.0, 20.0, 20.0, 20.0, 17.0, 17.5, 18.5, 17.0, 17.5, 20.0, 17.5, 16.5, 11.0, 19.5, 19.5, 19.5, 20.0, 16.0, 20.0, 20.0]
Mean: 18.21875
Median: 19.0
Mode: 20.0 With count: 10