From d2e86cdf91adc305fca149b045a8fe46bdfcf7d8 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Sat, 24 Feb 2018 01:54:21 -0600 Subject: [PATCH 1/4] Fixed issue with leftover test.json file --- doc/source/whatsnew/v0.23.0.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index ca5749afd11bc..46876ccf91f63 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -214,11 +214,21 @@ Please note that the string `index` is not supported with the round trip format, :okwarning: df.index.name = 'index' - df.to_json('test.json', orient='table') - new_df = pd.read_json('test.json', orient='table') + + test_json_buf = io.StringIO() + + # Write the serialized JSON object to the buffer. + df.to_json(test_json_buf, orient='table') + + # Reset the file pointer. + test_json_buf.seek(0) + + new_df = pd.read_json(test_json_buf, orient='table') new_df print(new_df.index.name) + # Close the file descriptor. + test_json_buf.close() .. _whatsnew_0230.enhancements.assign_dependent: ``.assign()`` accepts dependent arguments From 80421fc44aaba5aed7d6c90ebb8a56b459609c2a Mon Sep 17 00:00:00 2001 From: Jerry James Date: Sat, 24 Feb 2018 01:58:10 -0600 Subject: [PATCH 2/4] Added import statement --- doc/source/whatsnew/v0.23.0.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index 46876ccf91f63..975b5c08c9ded 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -212,6 +212,7 @@ Please note that the string `index` is not supported with the round trip format, .. ipython:: python :okwarning: + import io df.index.name = 'index' @@ -222,7 +223,7 @@ Please note that the string `index` is not supported with the round trip format, # Reset the file pointer. test_json_buf.seek(0) - + new_df = pd.read_json(test_json_buf, orient='table') new_df print(new_df.index.name) From dd1cb94a0c1d4f2dc0e9d0bbf20d414d848ef3f2 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Sat, 24 Feb 2018 14:55:56 -0600 Subject: [PATCH 3/4] Reverted python buffer and removed file --- doc/source/whatsnew/v0.23.0.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index 975b5c08c9ded..162d4c4a481f2 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -212,26 +212,26 @@ Please note that the string `index` is not supported with the round trip format, .. ipython:: python :okwarning: - import io df.index.name = 'index' - test_json_buf = io.StringIO() - # Write the serialized JSON object to the buffer. - df.to_json(test_json_buf, orient='table') + df.to_json('test.json', orient='table') - # Reset the file pointer. - test_json_buf.seek(0) - - new_df = pd.read_json(test_json_buf, orient='table') + new_df = pd.read_json('test.json', orient='table') new_df print(new_df.index.name) - # Close the file descriptor. - test_json_buf.close() +.. ipython:: python + :suppress: + + import os + os.remove('test.json') + + .. _whatsnew_0230.enhancements.assign_dependent: + ``.assign()`` accepts dependent arguments ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 7927c6a4c78033db8ba192eb8959d9eef92f47ff Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Sun, 25 Feb 2018 11:16:23 -0500 Subject: [PATCH 4/4] clean --- doc/source/whatsnew/v0.23.0.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index f91a30cca1164..c6156c5310e99 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -215,12 +215,10 @@ Please note that the string `index` is not supported with the round trip format, df.index.name = 'index' - # Write the serialized JSON object to the buffer. df.to_json('test.json', orient='table') - new_df = pd.read_json('test.json', orient='table') new_df - print(new_df.index.name) + new_df.dtypes .. ipython:: python :suppress: