changed it to build dataset with a few more variables
[babynames-cdsw] / BabyNames.ipynb
index 8173933d3ae801a07001de18d27650e4f6b54c93..8a8247652dce981a2327dc658122c20df6101e9d 100644 (file)
@@ -6,19 +6,7 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "NAMES_LIST = \"yob2018.txt\"\n",
-    "\n",
-    "boys = {}\n",
-    "girls = {}\n",
-    "\n",
-    "for line in open(NAMES_LIST, 'r').readlines():\n",
-    "    name, gender, count = line.strip().split(\",\")\n",
-    "    count = int(count)\n",
-    "\n",
-    "    if gender == \"F\":\n",
-    "        girls[name.lower()] = count\n",
-    "    elif gender == \"M\":\n",
-    "        boys[name.lower()] = count"
+    "from ssadata import boys, girls"
    ]
   },
   {
@@ -49,7 +37,7 @@
    "source": [
     "for name in boys.keys():\n",
     "    if name in girls.keys():\n",
-    "        print(name)\n"
+    "        print(name)"
    ]
   },
   {
     "    if 'queen' == name:\n",
     "        print(name + \" \" + str(girls[name]))"
    ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "## Now practice your new skills.  Here are some examples of questions you might ask. If you think of any other questions that you think it might be interesting to answer then you should also try to answer those as well!\n",
-    "\n",
-    "\n",
-    "Search for your own name. Are there both boys and girls that have your name? Is it more popular for one group than for the other?\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "\n",
-    "Are there more boys' names or girls' names? What about for particular first letters? What about for ''every'' first letter?\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "What is the longest name in the dataset?\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "What is the most common name and how often does it occur?"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "What is the least common name and how often does it occur? Does that concern you?"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "How many boys and girls are described in the dataset (i.e., how many boys and girls born in 2018 have names given to at least four others)?\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "How many boys' names are also girls' names? How many girls' names are also boys' names?"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "How many names are subsets of other names?"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "\n",
-    "What is the most popular girls' name that is also a boys' name?\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Write a function that takes a prefix as input and prints the number of boys and girls with that prefix (e.g., get_names(\"m\") would list all names that start with \"m\" and get_names(\"ma\") would only list those that start with \"ma\")."
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
   }
  ],
  "metadata": {
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.7.4"
+   "version": "3.9.2"
   }
  },
  "nbformat": 4,

Benjamin Mako Hill || Want to submit a patch?