{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Birth Dates In The United States\n",
    "\n",
    "The raw data behind the story **Some People Are Too Superstitious To Have A Baby On Friday The 13th**, which you can read [here](http://fivethirtyeight.com/features/some-people-are-too-superstitious-to-have-a-baby-on-friday-the-13th/).\n",
    "\n",
    "We'll be working with the data set from the Centers for Disease Control and Prevention's National National Center for Health Statistics.  The data set has the following structure:\n",
    "\n",
    "- `year` - Year\n",
    "- `month` - Month\n",
    "- `date_of_month` - Day number of the month\n",
    "- `day_of_week` - Day of week, where 1 is Monday and 7 is Sunday\n",
    "- `births` - Number of births"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "f = open(\"births.csv\", 'r')\n",
    "text = f.read()\n",
    "print(text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "lines_list = text.split(\"\\n\")\n",
    "lines_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "data_no_header = lines_list[1:len(lines_list)]\n",
    "days_counts = dict()\n",
    "\n",
    "for line in data_no_header:\n",
    "    split_line = line.split(\",\")\n",
    "    day_of_week = split_line[3]\n",
    "    num_births = int(split_line[4])\n",
    "\n",
    "    if day_of_week in days_counts:\n",
    "        days_counts[day_of_week] = days_counts[day_of_week] + num_births\n",
    "    else:\n",
    "        days_counts[day_of_week] = num_births\n",
    "\n",
    "days_counts"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "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.4.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}