X-Git-Url: https://projects.mako.cc/source/harrypotter-wikipedia-cdsw/blobdiff_plain/ce5c13c094d659125fe85d59b9bc0e4c2bf40072..3248892a26a9f80a1a8d6ef5da9ad89a26ca03df:/harrypotter_minor_edits.ipynb diff --git a/harrypotter_minor_edits.ipynb b/harrypotter_minor_edits.ipynb new file mode 100644 index 0000000..135f4be --- /dev/null +++ b/harrypotter_minor_edits.ipynb @@ -0,0 +1,77 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from csv import DictReader" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "input_file = open(\"hp_wiki.tsv\", 'r', encoding='utf-8')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "num_edits = 0\n", + "num_anon = 0\n", + "for row in DictReader(input_file, delimiter=\"\\t\"):\n", + " num_edits = num_edits + 1\n", + " if row[\"anon\"] == \"True\":\n", + " num_anon = num_anon + 1\n", + "\n", + "prop_anon = num_anon / num_edits" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(f\"total edits: {num_edits}\")\n", + "print(f\"anon edits: {num_anon}\")\n", + "print(f\"proportion anon: {prop_anon}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}