mirror of
https://github.com/donnemartin/data-science-ipython-notebooks.git
synced 2024-03-22 13:30:56 +08:00
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:
parent
c7bc8e386f
commit
f31a289eab
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "",
|
"name": "",
|
||||||
"signature": "sha256:f776a525b9cd73f2f19e9e51e3318238aa9c122bb94228ae307286d483a6c2f1"
|
"signature": "sha256:1c8b7cab9b55eb5888612d0b5149649565c258456e73e61b039225439aa11502"
|
||||||
},
|
},
|
||||||
"nbformat": 3,
|
"nbformat": 3,
|
||||||
"nbformat_minor": 0,
|
"nbformat_minor": 0,
|
||||||
|
@ -261,7 +261,7 @@
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"input": [
|
"input": [
|
||||||
"df_1.replace({'state' : { 'MD' : 'MARYLAND' }})\n",
|
"df_1.replace({'state' : { 'MD' : 'MARYLAND' }}, inplace=True)\n",
|
||||||
"df_1"
|
"df_1"
|
||||||
],
|
],
|
||||||
"language": "python",
|
"language": "python",
|
||||||
|
@ -301,13 +301,13 @@
|
||||||
" <tr>\n",
|
" <tr>\n",
|
||||||
" <th>3</th>\n",
|
" <th>3</th>\n",
|
||||||
" <td> 4.0</td>\n",
|
" <td> 4.0</td>\n",
|
||||||
" <td> MD</td>\n",
|
" <td> MARYLAND</td>\n",
|
||||||
" <td> 2014</td>\n",
|
" <td> 2014</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
" <tr>\n",
|
" <tr>\n",
|
||||||
" <th>4</th>\n",
|
" <th>4</th>\n",
|
||||||
" <td> 4.1</td>\n",
|
" <td> 4.1</td>\n",
|
||||||
" <td> MD</td>\n",
|
" <td> MARYLAND</td>\n",
|
||||||
" <td> 2015</td>\n",
|
" <td> 2015</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
" </tbody>\n",
|
" </tbody>\n",
|
||||||
|
@ -322,8 +322,8 @@
|
||||||
"0 5.0 VIRGINIA 2012\n",
|
"0 5.0 VIRGINIA 2012\n",
|
||||||
"1 5.1 VIRGINIA 2013\n",
|
"1 5.1 VIRGINIA 2013\n",
|
||||||
"2 5.2 VIRGINIA 2014\n",
|
"2 5.2 VIRGINIA 2014\n",
|
||||||
"3 4.0 MD 2014\n",
|
"3 4.0 MARYLAND 2014\n",
|
||||||
"4 4.1 MD 2015"
|
"4 4.1 MARYLAND 2015"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -455,13 +455,13 @@
|
||||||
" <tr>\n",
|
" <tr>\n",
|
||||||
" <th>3</th>\n",
|
" <th>3</th>\n",
|
||||||
" <td> 4.0</td>\n",
|
" <td> 4.0</td>\n",
|
||||||
" <td> MD</td>\n",
|
" <td> MARYLAND</td>\n",
|
||||||
" <td> 2014</td>\n",
|
" <td> 2014</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
" <tr>\n",
|
" <tr>\n",
|
||||||
" <th>4</th>\n",
|
" <th>4</th>\n",
|
||||||
" <td> 4.1</td>\n",
|
" <td> 4.1</td>\n",
|
||||||
" <td> MD</td>\n",
|
" <td> MARYLAND</td>\n",
|
||||||
" <td> 2015</td>\n",
|
" <td> 2015</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
" <tr>\n",
|
" <tr>\n",
|
||||||
|
@ -506,8 +506,8 @@
|
||||||
"0 5.0 VIRGINIA 2012\n",
|
"0 5.0 VIRGINIA 2012\n",
|
||||||
"1 5.1 VIRGINIA 2013\n",
|
"1 5.1 VIRGINIA 2013\n",
|
||||||
"2 5.2 VIRGINIA 2014\n",
|
"2 5.2 VIRGINIA 2014\n",
|
||||||
"3 4.0 MD 2014\n",
|
"3 4.0 MARYLAND 2014\n",
|
||||||
"4 4.1 MD 2015\n",
|
"4 4.1 MARYLAND 2015\n",
|
||||||
"0 6.0 NY 2012\n",
|
"0 6.0 NY 2012\n",
|
||||||
"1 6.1 NY 2013\n",
|
"1 6.1 NY 2013\n",
|
||||||
"2 6.2 NY 2014\n",
|
"2 6.2 NY 2014\n",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user