diff --git a/10_Deleting/Wine/Exercises.ipynb b/10_Deleting/Wine/Exercises.ipynb index 09cc35c57..9bde6e972 100644 --- a/10_Deleting/Wine/Exercises.ipynb +++ b/10_Deleting/Wine/Exercises.ipynb @@ -176,7 +176,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 11. Set the rows of the random numbers in the column" + "### Step 11. Use random numbers you generated as an index and assign NaN value to each of cell." ] }, { @@ -208,7 +208,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 14. Print only the non-null values in alcohol" + "### Step 13. Delete the rows that contain missing values" ] }, { @@ -224,7 +224,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 13. Delete the rows that contain missing values" + "### Step 14. Print only the non-null values in alcohol" ] }, { @@ -236,6 +236,15 @@ "outputs": [], "source": [] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "metadata": {}, @@ -271,7 +280,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, @@ -285,7 +294,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.11" + "version": "2.7.12" } }, "nbformat": 4, diff --git a/10_Deleting/Wine/Exercises_code_and_solutions.ipynb b/10_Deleting/Wine/Exercises_code_and_solutions.ipynb index 188d7c8aa..74c5373c6 100644 --- a/10_Deleting/Wine/Exercises_code_and_solutions.ipynb +++ b/10_Deleting/Wine/Exercises_code_and_solutions.ipynb @@ -21,7 +21,7 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 2, "metadata": { "collapsed": false }, @@ -47,7 +47,7 @@ }, { "cell_type": "code", - "execution_count": 86, + "execution_count": 3, "metadata": { "collapsed": false }, @@ -182,7 +182,7 @@ "4 1450 " ] }, - "execution_count": 86, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -203,7 +203,7 @@ }, { "cell_type": "code", - "execution_count": 87, + "execution_count": 4, "metadata": { "collapsed": false }, @@ -289,7 +289,7 @@ "4 14.20 1.76 15.2 112 3.39 1.97 6.75" ] }, - "execution_count": 87, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -318,7 +318,7 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": 5, "metadata": { "collapsed": false }, @@ -411,7 +411,7 @@ "4 1.97 6.75 " ] }, - "execution_count": 88, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -430,7 +430,7 @@ }, { "cell_type": "code", - "execution_count": 89, + "execution_count": 6, "metadata": { "collapsed": false }, @@ -523,7 +523,7 @@ "4 1.97 6.75 " ] }, - "execution_count": 89, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -542,7 +542,7 @@ }, { "cell_type": "code", - "execution_count": 90, + "execution_count": 7, "metadata": { "collapsed": false }, @@ -635,7 +635,7 @@ "4 1.97 6.75 " ] }, - "execution_count": 90, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -654,7 +654,7 @@ }, { "cell_type": "code", - "execution_count": 91, + "execution_count": 8, "metadata": { "collapsed": false }, @@ -747,7 +747,7 @@ "4 1.97 6.75 " ] }, - "execution_count": 91, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -769,7 +769,7 @@ }, { "cell_type": "code", - "execution_count": 92, + "execution_count": 9, "metadata": { "collapsed": false }, @@ -787,7 +787,7 @@ "dtype: int64" ] }, - "execution_count": 92, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -805,7 +805,7 @@ }, { "cell_type": "code", - "execution_count": 93, + "execution_count": 10, "metadata": { "collapsed": false }, @@ -813,10 +813,10 @@ { "data": { "text/plain": [ - "array([6, 6, 7, 4, 9, 4, 0, 1, 0, 8])" + "array([2, 3, 0, 5, 0, 9, 4, 0, 7, 2])" ] }, - "execution_count": 93, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -830,12 +830,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 11. Set the rows of the random numbers in the column" + "### Step 11. Use random numbers you generated as an index and assign NaN value to each of cell." ] }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 11, "metadata": { "collapsed": false }, @@ -870,7 +870,7 @@ " \n", " \n", " 1\n", - " NaN\n", + " 10.00\n", " 2.36\n", " 18.6\n", " 101.0\n", @@ -880,7 +880,7 @@ " \n", " \n", " 2\n", - " 10.00\n", + " NaN\n", " 1.95\n", " 16.8\n", " 100.0\n", @@ -890,7 +890,7 @@ " \n", " \n", " 3\n", - " 13.24\n", + " NaN\n", " 2.59\n", " 21.0\n", " 100.0\n", @@ -910,7 +910,7 @@ " \n", " \n", " 5\n", - " 14.39\n", + " NaN\n", " 1.87\n", " 14.6\n", " 96.0\n", @@ -920,7 +920,7 @@ " \n", " \n", " 6\n", - " NaN\n", + " 14.06\n", " 2.15\n", " 17.6\n", " 121.0\n", @@ -940,7 +940,7 @@ " \n", " \n", " 8\n", - " NaN\n", + " 13.86\n", " 1.35\n", " 16.0\n", " 98.0\n", @@ -965,14 +965,14 @@ "text/plain": [ " alcohol malic_acid alcalinity_of_ash magnesium flavanoids \\\n", "0 NaN 1.78 11.2 100.0 2.76 \n", - "1 NaN 2.36 18.6 101.0 3.24 \n", - "2 10.00 1.95 16.8 100.0 3.49 \n", - "3 13.24 2.59 21.0 100.0 2.69 \n", + "1 10.00 2.36 18.6 101.0 3.24 \n", + "2 NaN 1.95 16.8 100.0 3.49 \n", + "3 NaN 2.59 21.0 100.0 2.69 \n", "4 NaN 1.76 15.2 112.0 3.39 \n", - "5 14.39 1.87 14.6 96.0 2.52 \n", - "6 NaN 2.15 17.6 121.0 2.51 \n", + "5 NaN 1.87 14.6 96.0 2.52 \n", + "6 14.06 2.15 17.6 121.0 2.51 \n", "7 NaN 1.64 14.0 97.0 2.98 \n", - "8 NaN 1.35 16.0 98.0 3.15 \n", + "8 13.86 1.35 16.0 98.0 3.15 \n", "9 NaN 2.16 18.0 105.0 3.32 \n", "\n", " proanthocyanins hue \n", @@ -988,7 +988,7 @@ "9 2.38 5.75 " ] }, - "execution_count": 94, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -1007,7 +1007,7 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 12, "metadata": { "collapsed": false }, @@ -1025,7 +1025,7 @@ "dtype: int64" ] }, - "execution_count": 95, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -1038,22 +1038,220 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 14. Print only the non-null values in alcohol" + "### Step 13. Delete the rows that contain missing values" ] }, { "cell_type": "code", - "execution_count": 108, + "execution_count": 13, "metadata": { "collapsed": false }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
alcoholmalic_acidalcalinity_of_ashmagnesiumflavanoidsproanthocyaninshue
110.002.3618.6101.03.242.815.68
614.062.1517.6121.02.511.255.05
813.861.3516.098.03.151.857.22
1014.121.4816.895.02.431.575.00
1113.751.7316.089.02.761.815.60
\n", + "
" + ], + "text/plain": [ + " alcohol malic_acid alcalinity_of_ash magnesium flavanoids \\\n", + "1 10.00 2.36 18.6 101.0 3.24 \n", + "6 14.06 2.15 17.6 121.0 2.51 \n", + "8 13.86 1.35 16.0 98.0 3.15 \n", + "10 14.12 1.48 16.8 95.0 2.43 \n", + "11 13.75 1.73 16.0 89.0 2.76 \n", + "\n", + " proanthocyanins hue \n", + "1 2.81 5.68 \n", + "6 1.25 5.05 \n", + "8 1.85 7.22 \n", + "10 1.57 5.00 \n", + "11 1.81 5.60 " + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "wine = wine.dropna(axis = 0, how = \"any\")\n", + "wine.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Step 14. Print only the non-null values in alcohol" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false, + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "1 True\n", + "6 True\n", + "8 True\n", + "10 True\n", + "11 True\n", + "12 True\n", + "13 True\n", + "14 True\n", + "15 True\n", + "16 True\n", + "17 True\n", + "18 True\n", + "19 True\n", + "20 True\n", + "21 True\n", + "22 True\n", + "23 True\n", + "24 True\n", + "25 True\n", + "26 True\n", + "27 True\n", + "28 True\n", + "29 True\n", + "30 True\n", + "31 True\n", + "32 True\n", + "33 True\n", + "34 True\n", + "35 True\n", + "36 True\n", + " ... \n", + "147 True\n", + "148 True\n", + "149 True\n", + "150 True\n", + "151 True\n", + "152 True\n", + "153 True\n", + "154 True\n", + "155 True\n", + "156 True\n", + "157 True\n", + "158 True\n", + "159 True\n", + "160 True\n", + "161 True\n", + "162 True\n", + "163 True\n", + "164 True\n", + "165 True\n", + "166 True\n", + "167 True\n", + "168 True\n", + "169 True\n", + "170 True\n", + "171 True\n", + "172 True\n", + "173 True\n", + "174 True\n", + "175 True\n", + "176 True\n", + "Name: alcohol, dtype: bool" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "mask = wine.alcohol.notnull()\n", + "mask" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false, + "scrolled": true + }, "outputs": [ { "data": { "text/plain": [ - "2 10.00\n", - "3 13.24\n", - "5 14.39\n", + "1 10.00\n", + "6 14.06\n", + "8 13.86\n", "10 14.12\n", "11 13.75\n", "12 14.75\n", @@ -1115,130 +1313,15 @@ "Name: alcohol, dtype: float64" ] }, - "execution_count": 108, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "mask = wine.alcohol.notnull()\n", - "mask\n", - "\n", "wine.alcohol[mask]" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Step 13. Delete the rows that contain missing values" - ] - }, - { - "cell_type": "code", - "execution_count": 109, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
alcoholmalic_acidalcalinity_of_ashmagnesiumflavanoidsproanthocyaninshue
210.001.9516.8100.03.492.187.80
313.242.5921.0100.02.691.824.32
514.391.8714.696.02.521.985.25
1014.121.4816.895.02.431.575.00
1113.751.7316.089.02.761.815.60
\n", - "
" - ], - "text/plain": [ - " alcohol malic_acid alcalinity_of_ash magnesium flavanoids \\\n", - "2 10.00 1.95 16.8 100.0 3.49 \n", - "3 13.24 2.59 21.0 100.0 2.69 \n", - "5 14.39 1.87 14.6 96.0 2.52 \n", - "10 14.12 1.48 16.8 95.0 2.43 \n", - "11 13.75 1.73 16.0 89.0 2.76 \n", - "\n", - " proanthocyanins hue \n", - "2 2.18 7.80 \n", - "3 1.82 4.32 \n", - "5 1.98 5.25 \n", - "10 1.57 5.00 \n", - "11 1.81 5.60 " - ] - }, - "execution_count": 109, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "wine = wine.dropna(axis = 0, how = \"any\")\n", - "wine.head()" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -1248,7 +1331,7 @@ }, { "cell_type": "code", - "execution_count": 110, + "execution_count": 16, "metadata": { "collapsed": false }, @@ -1274,32 +1357,32 @@ " \n", " 0\n", " 10.00\n", - " 1.95\n", - " 16.8\n", - " 100.0\n", - " 3.49\n", - " 2.18\n", - " 7.80\n", + " 2.36\n", + " 18.6\n", + " 101.0\n", + " 3.24\n", + " 2.81\n", + " 5.68\n", " \n", " \n", " 1\n", - " 13.24\n", - " 2.59\n", - " 21.0\n", - " 100.0\n", - " 2.69\n", - " 1.82\n", - " 4.32\n", + " 14.06\n", + " 2.15\n", + " 17.6\n", + " 121.0\n", + " 2.51\n", + " 1.25\n", + " 5.05\n", " \n", " \n", " 2\n", - " 14.39\n", - " 1.87\n", - " 14.6\n", - " 96.0\n", - " 2.52\n", - " 1.98\n", - " 5.25\n", + " 13.86\n", + " 1.35\n", + " 16.0\n", + " 98.0\n", + " 3.15\n", + " 1.85\n", + " 7.22\n", " \n", " \n", " 3\n", @@ -1327,21 +1410,21 @@ ], "text/plain": [ " alcohol malic_acid alcalinity_of_ash magnesium flavanoids \\\n", - "0 10.00 1.95 16.8 100.0 3.49 \n", - "1 13.24 2.59 21.0 100.0 2.69 \n", - "2 14.39 1.87 14.6 96.0 2.52 \n", + "0 10.00 2.36 18.6 101.0 3.24 \n", + "1 14.06 2.15 17.6 121.0 2.51 \n", + "2 13.86 1.35 16.0 98.0 3.15 \n", "3 14.12 1.48 16.8 95.0 2.43 \n", "4 13.75 1.73 16.0 89.0 2.76 \n", "\n", " proanthocyanins hue \n", - "0 2.18 7.80 \n", - "1 1.82 4.32 \n", - "2 1.98 5.25 \n", + "0 2.81 5.68 \n", + "1 1.25 5.05 \n", + "2 1.85 7.22 \n", "3 1.57 5.00 \n", "4 1.81 5.60 " ] }, - "execution_count": 110, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -1369,8 +1452,9 @@ } ], "metadata": { + "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, @@ -1384,7 +1468,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.11" + "version": "2.7.12" } }, "nbformat": 4, diff --git a/10_Deleting/Wine/Solutions.ipynb b/10_Deleting/Wine/Solutions.ipynb index 0e76021c5..df9b41387 100644 --- a/10_Deleting/Wine/Solutions.ipynb +++ b/10_Deleting/Wine/Solutions.ipynb @@ -21,15 +21,12 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], - "source": [ - "import pandas as pd\n", - "import numpy as np" - ] + "source": [] }, { "cell_type": "markdown", @@ -47,7 +44,7 @@ }, { "cell_type": "code", - "execution_count": 86, + "execution_count": 3, "metadata": { "collapsed": false }, @@ -182,7 +179,7 @@ "4 1450 " ] }, - "execution_count": 86, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -198,7 +195,7 @@ }, { "cell_type": "code", - "execution_count": 87, + "execution_count": 4, "metadata": { "collapsed": false }, @@ -284,7 +281,7 @@ "4 14.20 1.76 15.2 112 3.39 1.97 6.75" ] }, - "execution_count": 87, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -309,7 +306,7 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": 5, "metadata": { "collapsed": false }, @@ -402,7 +399,7 @@ "4 1.97 6.75 " ] }, - "execution_count": 88, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -418,7 +415,7 @@ }, { "cell_type": "code", - "execution_count": 89, + "execution_count": 6, "metadata": { "collapsed": false }, @@ -511,7 +508,7 @@ "4 1.97 6.75 " ] }, - "execution_count": 89, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -527,7 +524,7 @@ }, { "cell_type": "code", - "execution_count": 90, + "execution_count": 7, "metadata": { "collapsed": false }, @@ -620,7 +617,7 @@ "4 1.97 6.75 " ] }, - "execution_count": 90, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -636,7 +633,7 @@ }, { "cell_type": "code", - "execution_count": 91, + "execution_count": 8, "metadata": { "collapsed": false }, @@ -729,7 +726,7 @@ "4 1.97 6.75 " ] }, - "execution_count": 91, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -745,7 +742,7 @@ }, { "cell_type": "code", - "execution_count": 92, + "execution_count": 9, "metadata": { "collapsed": false }, @@ -763,7 +760,7 @@ "dtype: int64" ] }, - "execution_count": 92, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -779,7 +776,7 @@ }, { "cell_type": "code", - "execution_count": 93, + "execution_count": 10, "metadata": { "collapsed": false }, @@ -787,28 +784,26 @@ { "data": { "text/plain": [ - "array([6, 6, 7, 4, 9, 4, 0, 1, 0, 8])" + "array([2, 3, 0, 5, 0, 9, 4, 0, 7, 2])" ] }, - "execution_count": 93, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], - "source": [ - "# the number will be randoms, so yours will be different" - ] + "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### Step 11. Set the rows of the random numbers in the column" + "### Step 11. Use random numbers you generated as an index and assign NaN value to each of cell." ] }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 11, "metadata": { "collapsed": false }, @@ -843,7 +838,7 @@ " \n", " \n", " 1\n", - " NaN\n", + " 10.00\n", " 2.36\n", " 18.6\n", " 101.0\n", @@ -853,7 +848,7 @@ " \n", " \n", " 2\n", - " 10.00\n", + " NaN\n", " 1.95\n", " 16.8\n", " 100.0\n", @@ -863,7 +858,7 @@ " \n", " \n", " 3\n", - " 13.24\n", + " NaN\n", " 2.59\n", " 21.0\n", " 100.0\n", @@ -883,7 +878,7 @@ " \n", " \n", " 5\n", - " 14.39\n", + " NaN\n", " 1.87\n", " 14.6\n", " 96.0\n", @@ -893,7 +888,7 @@ " \n", " \n", " 6\n", - " NaN\n", + " 14.06\n", " 2.15\n", " 17.6\n", " 121.0\n", @@ -913,7 +908,7 @@ " \n", " \n", " 8\n", - " NaN\n", + " 13.86\n", " 1.35\n", " 16.0\n", " 98.0\n", @@ -938,14 +933,14 @@ "text/plain": [ " alcohol malic_acid alcalinity_of_ash magnesium flavanoids \\\n", "0 NaN 1.78 11.2 100.0 2.76 \n", - "1 NaN 2.36 18.6 101.0 3.24 \n", - "2 10.00 1.95 16.8 100.0 3.49 \n", - "3 13.24 2.59 21.0 100.0 2.69 \n", + "1 10.00 2.36 18.6 101.0 3.24 \n", + "2 NaN 1.95 16.8 100.0 3.49 \n", + "3 NaN 2.59 21.0 100.0 2.69 \n", "4 NaN 1.76 15.2 112.0 3.39 \n", - "5 14.39 1.87 14.6 96.0 2.52 \n", - "6 NaN 2.15 17.6 121.0 2.51 \n", + "5 NaN 1.87 14.6 96.0 2.52 \n", + "6 14.06 2.15 17.6 121.0 2.51 \n", "7 NaN 1.64 14.0 97.0 2.98 \n", - "8 NaN 1.35 16.0 98.0 3.15 \n", + "8 13.86 1.35 16.0 98.0 3.15 \n", "9 NaN 2.16 18.0 105.0 3.32 \n", "\n", " proanthocyanins hue \n", @@ -961,14 +956,12 @@ "9 2.38 5.75 " ] }, - "execution_count": 94, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], - "source": [ - "# the number will be randoms, so yours will be different" - ] + "source": [] }, { "cell_type": "markdown", @@ -979,7 +972,7 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 12, "metadata": { "collapsed": false }, @@ -997,15 +990,122 @@ "dtype: int64" ] }, - "execution_count": 95, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, "source": [ - "# the number will be randoms, so yours will be different" + "### Step 13. Delete the rows that contain missing values" ] }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
alcoholmalic_acidalcalinity_of_ashmagnesiumflavanoidsproanthocyaninshue
110.002.3618.6101.03.242.815.68
614.062.1517.6121.02.511.255.05
813.861.3516.098.03.151.857.22
1014.121.4816.895.02.431.575.00
1113.751.7316.089.02.761.815.60
\n", + "
" + ], + "text/plain": [ + " alcohol malic_acid alcalinity_of_ash magnesium flavanoids \\\n", + "1 10.00 2.36 18.6 101.0 3.24 \n", + "6 14.06 2.15 17.6 121.0 2.51 \n", + "8 13.86 1.35 16.0 98.0 3.15 \n", + "10 14.12 1.48 16.8 95.0 2.43 \n", + "11 13.75 1.73 16.0 89.0 2.76 \n", + "\n", + " proanthocyanins hue \n", + "1 2.81 5.68 \n", + "6 1.25 5.05 \n", + "8 1.85 7.22 \n", + "10 1.57 5.00 \n", + "11 1.81 5.60 " + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [] + }, { "cell_type": "markdown", "metadata": {}, @@ -1015,17 +1115,100 @@ }, { "cell_type": "code", - "execution_count": 108, + "execution_count": 14, "metadata": { - "collapsed": false + "collapsed": false, + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "1 True\n", + "6 True\n", + "8 True\n", + "10 True\n", + "11 True\n", + "12 True\n", + "13 True\n", + "14 True\n", + "15 True\n", + "16 True\n", + "17 True\n", + "18 True\n", + "19 True\n", + "20 True\n", + "21 True\n", + "22 True\n", + "23 True\n", + "24 True\n", + "25 True\n", + "26 True\n", + "27 True\n", + "28 True\n", + "29 True\n", + "30 True\n", + "31 True\n", + "32 True\n", + "33 True\n", + "34 True\n", + "35 True\n", + "36 True\n", + " ... \n", + "147 True\n", + "148 True\n", + "149 True\n", + "150 True\n", + "151 True\n", + "152 True\n", + "153 True\n", + "154 True\n", + "155 True\n", + "156 True\n", + "157 True\n", + "158 True\n", + "159 True\n", + "160 True\n", + "161 True\n", + "162 True\n", + "163 True\n", + "164 True\n", + "165 True\n", + "166 True\n", + "167 True\n", + "168 True\n", + "169 True\n", + "170 True\n", + "171 True\n", + "172 True\n", + "173 True\n", + "174 True\n", + "175 True\n", + "176 True\n", + "Name: alcohol, dtype: bool" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false, + "scrolled": true }, "outputs": [ { "data": { "text/plain": [ - "2 10.00\n", - "3 13.24\n", - "5 14.39\n", + "1 10.00\n", + "6 14.06\n", + "8 13.86\n", "10 14.12\n", "11 13.75\n", "12 14.75\n", @@ -1087,125 +1270,12 @@ "Name: alcohol, dtype: float64" ] }, - "execution_count": 108, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# the number will be randoms, so yours will be different" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Step 13. Delete the rows that contain missing values" - ] - }, - { - "cell_type": "code", - "execution_count": 109, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
alcoholmalic_acidalcalinity_of_ashmagnesiumflavanoidsproanthocyaninshue
210.001.9516.8100.03.492.187.80
313.242.5921.0100.02.691.824.32
514.391.8714.696.02.521.985.25
1014.121.4816.895.02.431.575.00
1113.751.7316.089.02.761.815.60
\n", - "
" - ], - "text/plain": [ - " alcohol malic_acid alcalinity_of_ash magnesium flavanoids \\\n", - "2 10.00 1.95 16.8 100.0 3.49 \n", - "3 13.24 2.59 21.0 100.0 2.69 \n", - "5 14.39 1.87 14.6 96.0 2.52 \n", - "10 14.12 1.48 16.8 95.0 2.43 \n", - "11 13.75 1.73 16.0 89.0 2.76 \n", - "\n", - " proanthocyanins hue \n", - "2 2.18 7.80 \n", - "3 1.82 4.32 \n", - "5 1.98 5.25 \n", - "10 1.57 5.00 \n", - "11 1.81 5.60 " - ] - }, - "execution_count": 109, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], - "source": [ - "# the number will be randoms, so yours will be different" - ] + "source": [] }, { "cell_type": "markdown", @@ -1216,7 +1286,7 @@ }, { "cell_type": "code", - "execution_count": 110, + "execution_count": 16, "metadata": { "collapsed": false }, @@ -1242,32 +1312,32 @@ " \n", " 0\n", " 10.00\n", - " 1.95\n", - " 16.8\n", - " 100.0\n", - " 3.49\n", - " 2.18\n", - " 7.80\n", + " 2.36\n", + " 18.6\n", + " 101.0\n", + " 3.24\n", + " 2.81\n", + " 5.68\n", " \n", " \n", " 1\n", - " 13.24\n", - " 2.59\n", - " 21.0\n", - " 100.0\n", - " 2.69\n", - " 1.82\n", - " 4.32\n", + " 14.06\n", + " 2.15\n", + " 17.6\n", + " 121.0\n", + " 2.51\n", + " 1.25\n", + " 5.05\n", " \n", " \n", " 2\n", - " 14.39\n", - " 1.87\n", - " 14.6\n", - " 96.0\n", - " 2.52\n", - " 1.98\n", - " 5.25\n", + " 13.86\n", + " 1.35\n", + " 16.0\n", + " 98.0\n", + " 3.15\n", + " 1.85\n", + " 7.22\n", " \n", " \n", " 3\n", @@ -1295,21 +1365,21 @@ ], "text/plain": [ " alcohol malic_acid alcalinity_of_ash magnesium flavanoids \\\n", - "0 10.00 1.95 16.8 100.0 3.49 \n", - "1 13.24 2.59 21.0 100.0 2.69 \n", - "2 14.39 1.87 14.6 96.0 2.52 \n", + "0 10.00 2.36 18.6 101.0 3.24 \n", + "1 14.06 2.15 17.6 121.0 2.51 \n", + "2 13.86 1.35 16.0 98.0 3.15 \n", "3 14.12 1.48 16.8 95.0 2.43 \n", "4 13.75 1.73 16.0 89.0 2.76 \n", "\n", " proanthocyanins hue \n", - "0 2.18 7.80 \n", - "1 1.82 4.32 \n", - "2 1.98 5.25 \n", + "0 2.81 5.68 \n", + "1 1.25 5.05 \n", + "2 1.85 7.22 \n", "3 1.57 5.00 \n", "4 1.81 5.60 " ] }, - "execution_count": 110, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -1334,8 +1404,9 @@ } ], "metadata": { + "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 2", + "display_name": "Python [default]", "language": "python", "name": "python2" }, @@ -1349,7 +1420,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.11" + "version": "2.7.12" } }, "nbformat": 4,