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