improvements based on a run-through in COM597G
[harrypotter-wikipedia-cdsw] / hpwp-minor.py
index 4e173f2daa4db6aaeffebed47e9e3ff99181ee52..c327015f78f0370a23c30da037deed6a7ce476fc 100644 (file)
@@ -1,12 +1,12 @@
 from csv import DictReader
 
 from csv import DictReader
 
-input_file = open("hp_wiki.csv", 'r')
+input_file = open("hp_wiki.tsv", 'r', encoding="utf-8")
 
 num_edits = 0
 num_anon = 0
 
 num_edits = 0
 num_anon = 0
-for row in DictReader(input_file):
+for row in DictReader(input_file, delimiter="\t"):
     num_edits = num_edits + 1
     num_edits = num_edits + 1
-    if row["anon"] == "False":
+    if row["anon"] == "True":
         num_anon = num_anon + 1
 
 prop_anon = num_anon / num_edits
         num_anon = num_anon + 1
 
 prop_anon = num_anon / num_edits

Benjamin Mako Hill || Want to submit a patch?