inplace ops update

This commit is contained in:
rasbt 2015-01-25 00:10:54 -05:00
parent 632aef1bc4
commit d2039a7868

View File

@ -1,7 +1,7 @@
{ {
"metadata": { "metadata": {
"name": "", "name": "",
"signature": "sha256:cf7223086a74b13d1ae2228a4c8545c401765a90cdb3eca418f18138a4afdaab" "signature": "sha256:2c7029e546d20c06eaa707f59d5b067689bf8827b87cc32f4fae7b55cde6e0f2"
}, },
"nbformat": 3, "nbformat": 3,
"nbformat_minor": 0, "nbformat_minor": 0,
@ -29,7 +29,7 @@
"output_type": "stream", "output_type": "stream",
"stream": "stdout", "stream": "stdout",
"text": [ "text": [
"Sebastian Raschka 24/01/2015 \n", "Sebastian Raschka 25/01/2015 \n",
"\n", "\n",
"CPython 3.4.2\n", "CPython 3.4.2\n",
"IPython 2.3.1\n", "IPython 2.3.1\n",
@ -890,7 +890,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 8, "prompt_number": 7,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"7 Cesc F\u00e0bregas 14.0 20 2 14 10 \n", "7 Cesc F\u00e0bregas 14.0 20 2 14 10 \n",
@ -904,7 +904,7 @@
] ]
} }
], ],
"prompt_number": 8 "prompt_number": 7
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -1008,7 +1008,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 9, "prompt_number": 8,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"4 \u00c1ngel Di Mar\u00eda 15.0 13 3 NaN 13 \n", "4 \u00c1ngel Di Mar\u00eda 15.0 13 3 NaN 13 \n",
@ -1020,7 +1020,7 @@
] ]
} }
], ],
"prompt_number": 9 "prompt_number": 8
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -1177,7 +1177,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 10, "prompt_number": 9,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"0 Sergio Ag\u00fcero 19.2 16 14 3 34 \n", "0 Sergio Ag\u00fcero 19.2 16 14 3 34 \n",
@ -1201,7 +1201,7 @@
] ]
} }
], ],
"prompt_number": 10 "prompt_number": 9
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -1225,7 +1225,7 @@
"input": [ "input": [
"# Filling NaN cells with default value 0\n", "# Filling NaN cells with default value 0\n",
"\n", "\n",
"df = df.fillna(value=0)\n", "df.fillna(value=0, inplace=True)\n",
"df" "df"
], ],
"language": "python", "language": "python",
@ -1387,7 +1387,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 11, "prompt_number": 10,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"0 Sergio Ag\u00fcero 19.2 16 14 3 34 \n", "0 Sergio Ag\u00fcero 19.2 16 14 3 34 \n",
@ -1415,7 +1415,7 @@
] ]
} }
], ],
"prompt_number": 11 "prompt_number": 10
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -1523,7 +1523,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 12, "prompt_number": 11,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"8 Saido Berahino 13.8 21 9 0 20 \n", "8 Saido Berahino 13.8 21 9 0 20 \n",
@ -1537,7 +1537,7 @@
] ]
} }
], ],
"prompt_number": 12 "prompt_number": 11
}, },
{ {
"cell_type": "code", "cell_type": "code",
@ -1617,7 +1617,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 13, "prompt_number": 12,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"8 Saido Berahino 13.8 21 9 0 20 \n", "8 Saido Berahino 13.8 21 9 0 20 \n",
@ -1631,7 +1631,7 @@
] ]
} }
], ],
"prompt_number": 13 "prompt_number": 12
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -1662,7 +1662,7 @@
"input": [ "input": [
"# Sorting the DataFrame by a certain column (from highest to lowest)\n", "# Sorting the DataFrame by a certain column (from highest to lowest)\n",
"\n", "\n",
"df = df.sort('goals', ascending=False)\n", "df.sort('goals', ascending=False, inplace=True)\n",
"df.head()" "df.head()"
], ],
"language": "python", "language": "python",
@ -1759,7 +1759,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 14, "prompt_number": 13,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"0 Sergio Ag\u00fcero 19.2 16 14 3 34 \n", "0 Sergio Ag\u00fcero 19.2 16 14 3 34 \n",
@ -1777,7 +1777,7 @@
] ]
} }
], ],
"prompt_number": 14 "prompt_number": 13
}, },
{ {
"cell_type": "code", "cell_type": "code",
@ -1882,7 +1882,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 15, "prompt_number": 14,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"1 Sergio Ag\u00fcero 19.2 16 14 3 34 \n", "1 Sergio Ag\u00fcero 19.2 16 14 3 34 \n",
@ -1900,7 +1900,7 @@
] ]
} }
], ],
"prompt_number": 15 "prompt_number": 14
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -2003,7 +2003,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 16, "prompt_number": 15,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"1 Sergio Ag\u00fcero 20 16 14 3 34 \n", "1 Sergio Ag\u00fcero 20 16 14 3 34 \n",
@ -2017,7 +2017,7 @@
] ]
} }
], ],
"prompt_number": 16 "prompt_number": 15
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -2114,7 +2114,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 17, "prompt_number": 16,
"text": [ "text": [
" salary games goals assists shots_on_target \\\n", " salary games goals assists shots_on_target \\\n",
"player \n", "player \n",
@ -2130,7 +2130,7 @@
] ]
} }
], ],
"prompt_number": 17 "prompt_number": 16
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -2224,7 +2224,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 18, "prompt_number": 17,
"text": [ "text": [
" salary games goals assists shots_on_target \\\n", " salary games goals assists shots_on_target \\\n",
"player \n", "player \n",
@ -2240,7 +2240,7 @@
] ]
} }
], ],
"prompt_number": 18 "prompt_number": 17
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -2326,7 +2326,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 19, "prompt_number": 18,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"0 Sergio Ag\u00fcero 20 16 14 3 34 \n", "0 Sergio Ag\u00fcero 20 16 14 3 34 \n",
@ -2340,7 +2340,7 @@
] ]
} }
], ],
"prompt_number": 19 "prompt_number": 18
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -2454,7 +2454,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 20, "prompt_number": 19,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"1 Alexis S\u00e1nchez 15 0 12 7 29 \n", "1 Alexis S\u00e1nchez 15 0 12 7 29 \n",
@ -2470,7 +2470,7 @@
] ]
} }
], ],
"prompt_number": 20 "prompt_number": 19
}, },
{ {
"cell_type": "code", "cell_type": "code",
@ -2522,7 +2522,7 @@
], ],
"metadata": {}, "metadata": {},
"output_type": "pyout", "output_type": "pyout",
"prompt_number": 22, "prompt_number": 20,
"text": [ "text": [
" player salary games goals assists shots_on_target \\\n", " player salary games goals assists shots_on_target \\\n",
"1 Alexis S\u00e1nchez 15 0 12 7 29 \n", "1 Alexis S\u00e1nchez 15 0 12 7 29 \n",
@ -2532,7 +2532,7 @@
] ]
} }
], ],
"prompt_number": 22 "prompt_number": 20
} }
], ],
"metadata": {} "metadata": {}