From f31a289eab435974261097bccc07e95a7b689329 Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Fri, 13 Feb 2015 15:54:23 -0500 Subject: [PATCH] Fixed bug in replace snippet where a copy of a DataFrame was being created instead of doing the replace in place. --- pandas/pandas_clean.ipynb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pandas/pandas_clean.ipynb b/pandas/pandas_clean.ipynb index 8523bc3..42b5484 100644 --- a/pandas/pandas_clean.ipynb +++ b/pandas/pandas_clean.ipynb @@ -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 @@ " \n", " 3\n", " 4.0\n", - " MD\n", + " MARYLAND\n", " 2014\n", " \n", " \n", " 4\n", " 4.1\n", - " MD\n", + " MARYLAND\n", " 2015\n", " \n", " \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 @@ " \n", " 3\n", " 4.0\n", - " MD\n", + " MARYLAND\n", " 2014\n", " \n", " \n", " 4\n", " 4.1\n", - " MD\n", + " MARYLAND\n", " 2015\n", " \n", " \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",