From 740cafe6b14cdc324d6fc4688d2cc2b972e34df1 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Thu, 15 Dec 2016 21:18:02 -0800 Subject: [PATCH] TST: to_json keeps column info with empty dataframe (#7445) Move test --- pandas/io/tests/json/test_pandas.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandas/io/tests/json/test_pandas.py b/pandas/io/tests/json/test_pandas.py index e6e6f33669e17..d7f903153fdae 100644 --- a/pandas/io/tests/json/test_pandas.py +++ b/pandas/io/tests/json/test_pandas.py @@ -388,6 +388,10 @@ def test_frame_empty(self): self.assertFalse(df._is_mixed_type) assert_frame_equal(read_json(df.to_json(), dtype=dict(df.dtypes)), df, check_index_type=False) + # GH 7445 + result = pd.DataFrame({'test': []}, index=[]).to_json(orient='columns') + expected = '{"test":{}}' + tm.assert_equal(result, expected) def test_frame_empty_mixedtype(self): # mixed type