Fixed bug in replace snippet where a copy of a DataFrame was being created instead of doing the replace in place.

This commit is contained in:
Donne Martin 2015-02-13 15:54:23 -05:00
parent c7bc8e386f
commit f31a289eab

View File

@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:f776a525b9cd73f2f19e9e51e3318238aa9c122bb94228ae307286d483a6c2f1"
"signature": "sha256:1c8b7cab9b55eb5888612d0b5149649565c258456e73e61b039225439aa11502"
},
"nbformat": 3,
"nbformat_minor": 0,
@ -261,7 +261,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"df_1.replace({'state' : { 'MD' : 'MARYLAND' }})\n",
"df_1.replace({'state' : { 'MD' : 'MARYLAND' }}, inplace=True)\n",
"df_1"
],
"language": "python",
@ -301,13 +301,13 @@
" <tr>\n",
" <th>3</th>\n",
" <td> 4.0</td>\n",
" <td> MD</td>\n",
" <td> MARYLAND</td>\n",
" <td> 2014</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td> 4.1</td>\n",
" <td> MD</td>\n",
" <td> MARYLAND</td>\n",
" <td> 2015</td>\n",
" </tr>\n",
" </tbody>\n",
@ -322,8 +322,8 @@
"0 5.0 VIRGINIA 2012\n",
"1 5.1 VIRGINIA 2013\n",
"2 5.2 VIRGINIA 2014\n",
"3 4.0 MD 2014\n",
"4 4.1 MD 2015"
"3 4.0 MARYLAND 2014\n",
"4 4.1 MARYLAND 2015"
]
}
],
@ -455,13 +455,13 @@
" <tr>\n",
" <th>3</th>\n",
" <td> 4.0</td>\n",
" <td> MD</td>\n",
" <td> MARYLAND</td>\n",
" <td> 2014</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td> 4.1</td>\n",
" <td> MD</td>\n",
" <td> MARYLAND</td>\n",
" <td> 2015</td>\n",
" </tr>\n",
" <tr>\n",
@ -506,8 +506,8 @@
"0 5.0 VIRGINIA 2012\n",
"1 5.1 VIRGINIA 2013\n",
"2 5.2 VIRGINIA 2014\n",
"3 4.0 MD 2014\n",
"4 4.1 MD 2015\n",
"3 4.0 MARYLAND 2014\n",
"4 4.1 MARYLAND 2015\n",
"0 6.0 NY 2012\n",
"1 6.1 NY 2013\n",
"2 6.2 NY 2014\n",