Queer European MD passionate about IT
Browse Source

Solution notebook fixes

michal 7 years ago
parent
commit
ecc97c3cd2
3 changed files with 96 additions and 89 deletions
  1. 2 4
      Mission149Solutions.ipynb
  2. 11 27
      Mission216Solutions.ipynb
  3. 83 58
      Mission219Solution.ipynb

File diff suppressed because it is too large
+ 2 - 4
Mission149Solutions.ipynb


+ 11 - 27
Mission216Solutions.ipynb

@@ -10,9 +10,7 @@
   {
    "cell_type": "code",
    "execution_count": 1,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
@@ -60,9 +58,7 @@
   {
    "cell_type": "code",
    "execution_count": 2,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
@@ -105,9 +101,7 @@
   {
    "cell_type": "code",
    "execution_count": 3,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "data": {
@@ -134,9 +128,7 @@
   {
    "cell_type": "code",
    "execution_count": 4,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
@@ -153,7 +145,7 @@
     "nominee text, \n",
     "movie text, \n",
     "character text, \n",
-    "won text,\n",
+    "won integer,\n",
     "ceremony_id integer,\n",
     "foreign key(ceremony_id) references ceremonies(id));\n",
     "'''\n",
@@ -189,9 +181,7 @@
   {
    "cell_type": "code",
    "execution_count": 5,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "data": {
@@ -222,9 +212,7 @@
   {
    "cell_type": "code",
    "execution_count": 6,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "data": {
@@ -258,9 +246,7 @@
   {
    "cell_type": "code",
    "execution_count": 7,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
@@ -291,9 +277,7 @@
   {
    "cell_type": "code",
    "execution_count": 8,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
@@ -339,9 +323,9 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.5.1"
+   "version": "3.6.1"
   }
  },
  "nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 1
 }

+ 83 - 58
Mission219Solution.ipynb

@@ -9,13 +9,26 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 39,
+   "execution_count": 1,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/html": [
        "<div>\n",
+       "<style>\n",
+       "    .dataframe thead tr:only-child th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: left;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "</style>\n",
        "<table border=\"1\" class=\"dataframe\">\n",
        "  <thead>\n",
        "    <tr style=\"text-align: right;\">\n",
@@ -292,7 +305,7 @@
        "[5 rows x 65 columns]"
       ]
      },
-     "execution_count": 39,
+     "execution_count": 1,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -306,7 +319,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 40,
+   "execution_count": 2,
    "metadata": {},
    "outputs": [
     {
@@ -377,7 +390,7 @@
        "      dtype='object')"
       ]
      },
-     "execution_count": 40,
+     "execution_count": 2,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -395,7 +408,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 41,
+   "execution_count": 3,
    "metadata": {},
    "outputs": [
     {
@@ -406,7 +419,7 @@
        "Name: Do you celebrate Thanksgiving?, dtype: int64"
       ]
      },
-     "execution_count": 41,
+     "execution_count": 3,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -417,8 +430,10 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 42,
-   "metadata": {},
+   "execution_count": 4,
+   "metadata": {
+    "collapsed": true
+   },
    "outputs": [],
    "source": [
     "data = data[data[\"Do you celebrate Thanksgiving?\"] == \"Yes\"]"
@@ -433,7 +448,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 43,
+   "execution_count": 5,
    "metadata": {},
    "outputs": [
     {
@@ -450,7 +465,7 @@
        "Name: What is typically the main dish at your Thanksgiving dinner?, dtype: int64"
       ]
      },
-     "execution_count": 43,
+     "execution_count": 5,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -461,7 +476,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 44,
+   "execution_count": 6,
    "metadata": {},
    "outputs": [
     {
@@ -490,7 +505,7 @@
        "Name: Do you typically have gravy?, dtype: object"
       ]
      },
-     "execution_count": 44,
+     "execution_count": 6,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -508,7 +523,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 51,
+   "execution_count": 7,
    "metadata": {},
    "outputs": [
     {
@@ -518,7 +533,7 @@
        "Name: Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Apple, dtype: int64"
       ]
      },
-     "execution_count": 51,
+     "execution_count": 7,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -529,7 +544,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 52,
+   "execution_count": 8,
    "metadata": {},
    "outputs": [
     {
@@ -540,7 +555,7 @@
        "dtype: int64"
       ]
      },
-     "execution_count": 52,
+     "execution_count": 8,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -565,7 +580,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 45,
+   "execution_count": 9,
    "metadata": {},
    "outputs": [
     {
@@ -578,7 +593,7 @@
        "Name: Age, dtype: int64"
       ]
      },
-     "execution_count": 45,
+     "execution_count": 9,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -589,17 +604,9 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 46,
+   "execution_count": 10,
    "metadata": {},
    "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "/Users/vik/python_envs/dscontent/lib/python3.4/site-packages/numpy/lib/function_base.py:3834: RuntimeWarning: Invalid value encountered in percentile\n",
-      "  RuntimeWarning)\n"
-     ]
-    },
     {
      "data": {
       "text/plain": [
@@ -607,14 +614,14 @@
        "mean      40.089757\n",
        "std       15.352014\n",
        "min       18.000000\n",
-       "25%             NaN\n",
-       "50%             NaN\n",
-       "75%             NaN\n",
+       "25%       30.000000\n",
+       "50%       45.000000\n",
+       "75%       60.000000\n",
        "max       60.000000\n",
        "Name: int_age, dtype: float64"
       ]
      },
-     "execution_count": 46,
+     "execution_count": 10,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -649,7 +656,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 47,
+   "execution_count": 11,
    "metadata": {},
    "outputs": [
     {
@@ -669,7 +676,7 @@
        "Name: How much total combined money did all members of your HOUSEHOLD earn last year?, dtype: int64"
       ]
      },
-     "execution_count": 47,
+     "execution_count": 11,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -680,17 +687,9 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 48,
+   "execution_count": 12,
    "metadata": {},
    "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "/Users/vik/python_envs/dscontent/lib/python3.4/site-packages/numpy/lib/function_base.py:3834: RuntimeWarning: Invalid value encountered in percentile\n",
-      "  RuntimeWarning)\n"
-     ]
-    },
     {
      "data": {
       "text/plain": [
@@ -698,14 +697,14 @@
        "mean      75965.018094\n",
        "std       59068.636748\n",
        "min           0.000000\n",
-       "25%                NaN\n",
-       "50%                NaN\n",
-       "75%                NaN\n",
+       "25%       25000.000000\n",
+       "50%       75000.000000\n",
+       "75%      100000.000000\n",
        "max      200000.000000\n",
        "Name: int_income, dtype: float64"
       ]
      },
-     "execution_count": 48,
+     "execution_count": 12,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -743,20 +742,20 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 49,
+   "execution_count": 13,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "Thanksgiving is happening at my home--I won't travel at all                         106\n",
-       "Thanksgiving is local--it will take place in the town I live in                      92\n",
-       "Thanksgiving is out of town but not too far--it's a drive of a few hours or less     64\n",
-       "Thanksgiving is out of town and far away--I have to drive several hours or fly       16\n",
+       "Thanksgiving is happening at my home--I won't travel at all                         281\n",
+       "Thanksgiving is local--it will take place in the town I live in                     203\n",
+       "Thanksgiving is out of town but not too far--it's a drive of a few hours or less    150\n",
+       "Thanksgiving is out of town and far away--I have to drive several hours or fly       55\n",
        "Name: How far will you travel for Thanksgiving?, dtype: int64"
       ]
      },
-     "execution_count": 49,
+     "execution_count": 13,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -767,7 +766,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 50,
+   "execution_count": 14,
    "metadata": {},
    "outputs": [
     {
@@ -780,7 +779,7 @@
        "Name: How far will you travel for Thanksgiving?, dtype: int64"
       ]
      },
-     "execution_count": 50,
+     "execution_count": 14,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -807,13 +806,26 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 53,
+   "execution_count": 15,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/html": [
        "<div>\n",
+       "<style>\n",
+       "    .dataframe thead tr:only-child th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: left;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "</style>\n",
        "<table border=\"1\" class=\"dataframe\">\n",
        "  <thead>\n",
        "    <tr style=\"text-align: right;\">\n",
@@ -849,7 +861,7 @@
        "Yes                                                 41.475410  33.976744"
       ]
      },
-     "execution_count": 53,
+     "execution_count": 15,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -864,13 +876,26 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 54,
+   "execution_count": 16,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/html": [
        "<div>\n",
+       "<style>\n",
+       "    .dataframe thead tr:only-child th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: left;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "</style>\n",
        "<table border=\"1\" class=\"dataframe\">\n",
        "  <thead>\n",
        "    <tr style=\"text-align: right;\">\n",
@@ -906,7 +931,7 @@
        "Yes                                                 78750.000000  66019.736842"
       ]
      },
-     "execution_count": 54,
+     "execution_count": 16,
      "metadata": {},
      "output_type": "execute_result"
     }

Some files were not shown because too many files changed in this diff