diff options
-rw-r--r-- | main.py | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -50,17 +50,16 @@ ban_list = map_bans(ban_dict_list) | |||
50 | ########## HISTOGRAM ########## | 50 | ########## HISTOGRAM ########## |
51 | 51 | ||
52 | ban_durations = [ban.get_duration() for ban in ban_list] | 52 | ban_durations = [ban.get_duration() for ban in ban_list] |
53 | (ban_durations, bins) = np.histogram(ban_durations, bins=[round(365/12*x) for x in range(1, 50+2)]) | 53 | (ban_durations_bars, bins) = np.histogram(ban_durations, bins=[round(365/12*x) for x in range(1, 50+2)]) |
54 | 54 | ||
55 | print("[INFO]", "Generating histogram") | 55 | print("[INFO]", "Generating histogram") |
56 | bar_chart = pygal.Bar(legend_at_bottom=True) | 56 | bar_chart = pygal.Bar(legend_at_bottom=True) |
57 | bar_chart.title = "Active Wikipedia bans by duration (%d samples)" % SAMPLES | 57 | bar_chart.title = "Active Wikipedia bans by duration (%d samples)" % SAMPLES |
58 | bar_chart.x_labels = map(str, range(1, len(ban_durations)+1)) | 58 | bar_chart.x_labels = map(str, range(1, len(ban_durations_bars)+1)) |
59 | bar_chart.add("Number of active bans", ban_durations) | 59 | bar_chart.add("Number of active bans", ban_durations_bars) |
60 | bar_chart.render_to_file(HIST_FILE) | 60 | bar_chart.render_to_file(HIST_FILE) |
61 | print("[INFO]", "Histogram generation complete") | 61 | print("[INFO]", "Histogram generation complete") |
62 | 62 | ||
63 | |||
64 | ########## NB BAN MAP ########## | 63 | ########## NB BAN MAP ########## |
65 | 64 | ||
66 | def count_by_country(ban_list): | 65 | def count_by_country(ban_list): |
@@ -116,4 +115,10 @@ print("[INFO]", "Ban duration map generation complete") | |||
116 | 115 | ||
117 | print("\nTHIS WAS A TRIUMPH!") | 116 | print("\nTHIS WAS A TRIUMPH!") |
118 | print("I'M MAKING A NOTE HERE:") | 117 | print("I'M MAKING A NOTE HERE:") |
119 | print("HUGE [SUCCESS]") | 118 | print("HUGE [SUCCESS]\n") |
119 | |||
120 | print("Some additional stats about ban durations:") | ||
121 | print(" Mean: %.2f days" % np.mean(ban_durations)) | ||
122 | print(" Median: %.2f days" % np.median(ban_durations)) | ||
123 | print(" Deviation: %.2f" % np.std(ban_durations)) | ||
124 | print(" Variance: %.2f" % np.var(ban_durations)) | ||