X-Git-Url: https://projects.mako.cc/source/harrypotter-wikipedia-cdsw/blobdiff_plain/3248892a26a9f80a1a8d6ef5da9ad89a26ca03df..c3aed8c1b52241fa1ab6355a60a8327686a7ecd3:/hpwp-trend.py diff --git a/hpwp-trend.py b/hpwp-trend.py deleted file mode 100644 index b9d1c7b..0000000 --- a/hpwp-trend.py +++ /dev/null @@ -1,29 +0,0 @@ -import encoding_fix - -from csv import DictReader - -# read in the input file and count by day -input_file = open("hp_wiki.tsv", 'r', encoding="utf-8") - -edits_by_day = {} -for row in DictReader(input_file, delimiter="\t"): - day_string = row['timestamp'][0:10] - - if day_string in edits_by_day: - edits_by_day[day_string] = edits_by_day[day_string] + 1 - else: - edits_by_day[day_string] = 1 - -input_file.close() - -# output the counts by day -output_file = open("hp_edits_by_day.tsv", "w", encoding='utf-8') - -# write a header -output_file.write("date\tedits\n") - -# iterate through every day and print out data into the file -for day_string in edits_by_day.keys(): - output_file.write("\t".join([day_string, str(edits_by_day[day_string])]) + "\n") - -output_file.close()