Skip to content

Commit 740cafe

Browse files
committed
TST: to_json keeps column info with empty dataframe (#7445)
Move test
1 parent 3ba2cff commit 740cafe

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)