Skip to content

Commit 2566223

Browse files
mroeschkejreback
authored andcommitted
TST: to_json keeps column info with empty dataframe (#7445)
closes #7445 Author: Matt Roeschke <[email protected]> Closes #14893 from mroeschke/test_7445 and squashes the following commits: 740cafe [Matt Roeschke] TST: to_json keeps column info with empty dataframe (#7445)
1 parent e7df751 commit 2566223

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/io/tests/json/test_pandas.py

+4
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,10 @@ def test_frame_empty(self):
388388
self.assertFalse(df._is_mixed_type)
389389
assert_frame_equal(read_json(df.to_json(), dtype=dict(df.dtypes)), df,
390390
check_index_type=False)
391+
# GH 7445
392+
result = pd.DataFrame({'test': []}, index=[]).to_json(orient='columns')
393+
expected = '{"test":{}}'
394+
tm.assert_equal(result, expected)
391395

392396
def test_frame_empty_mixedtype(self):
393397
# mixed type

0 commit comments

Comments
 (0)