{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from bigbang.archive import load as load_archive\n",
    "from collections import defaultdict\n",
    "import csv\n",
    "\n",
    "url = 'http://mm.icann.org/pipermail/wp4/'\n",
    "\n",
    "stem = False\n",
    "\n",
    "try:\n",
    "    arch_path = '../archives/'+url[:-1].replace('://','_/')+'.csv'\n",
    "    archive = load_archive(arch_path).data\n",
    "except:\n",
    "    arch_path = '../archives/'+url[:-1].replace('//','/')+'.csv'\n",
    "    archive = load_archive(arch_path).data\n",
    "    \n",
    "    \n",
    "\n",
    "users = list(archive[\"From\"])\n",
    "users_count_f = open('../users_count.csv', \"wb\")\n",
    "users_count_w = csv.writer(users_count_f)\n",
    "for user in set(users):\n",
    "    users_count_w.writerow([user]+[list(archive[\"From\"]).count(user)])\n",
    "users_count_f.close()\n",
    "    \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'kimberly.carlson at icann.org (Kimberly Carlson)'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
