diff options
-rw-r--r-- | main.py | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -2,7 +2,7 @@ from collections import Counter | |||
2 | import webbrowser | 2 | import webbrowser |
3 | 3 | ||
4 | import pygal | 4 | import pygal |
5 | import numpy as np | 5 | import numpy |
6 | import pygeoip | 6 | import pygeoip |
7 | 7 | ||
8 | from wikibania.ban.BanDB import BanDB | 8 | from wikibania.ban.BanDB import BanDB |
@@ -49,7 +49,7 @@ ban_db_wrapper = BanDBWrapper(ban_db) | |||
49 | # HISTOGRAM | 49 | # HISTOGRAM |
50 | 50 | ||
51 | ban_durations = ban_db_wrapper.get_all_durations() | 51 | ban_durations = ban_db_wrapper.get_all_durations() |
52 | (ban_durations_bars, bins) = np.histogram(ban_durations, bins=range(1, 50 + 2)) | 52 | (ban_durations_bars, bins) = numpy.histogram(ban_durations, bins=range(1, 50 + 2)) |
53 | 53 | ||
54 | bar_chart = pygal.Bar(legend_at_bottom=True) | 54 | bar_chart = pygal.Bar(legend_at_bottom=True) |
55 | bar_chart.title = "Active Wikipedia bans by duration (%d samples)" % len(ban_db.list()) | 55 | bar_chart.title = "Active Wikipedia bans by duration (%d samples)" % len(ban_db.list()) |
@@ -65,10 +65,10 @@ if OPEN_FILES: | |||
65 | 65 | ||
66 | with open(STATS_FILE, "w") as stats_file: | 66 | with open(STATS_FILE, "w") as stats_file: |
67 | stats_file.write("Ban duration:\n") | 67 | stats_file.write("Ban duration:\n") |
68 | stats_file.write("Mean: %.2f days\n" % np.mean(ban_durations)) | 68 | stats_file.write("Mean: %.2f days\n" % numpy.mean(ban_durations)) |
69 | stats_file.write("Median: %.2f days\n" % np.median(ban_durations)) | 69 | stats_file.write("Median: %.2f days\n" % numpy.median(ban_durations)) |
70 | stats_file.write("Deviation: %.2f\n" % np.std(ban_durations)) | 70 | stats_file.write("Deviation: %.2f\n" % numpy.std(ban_durations)) |
71 | stats_file.write("Variance: %.2f\n" % np.var(ban_durations)) | 71 | stats_file.write("Variance: %.2f\n" % numpy.var(ban_durations)) |
72 | 72 | ||
73 | if OPEN_FILES: | 73 | if OPEN_FILES: |
74 | webbrowser.open(STATS_FILE, 2) | 74 | webbrowser.open(STATS_FILE, 2) |