Skip to content

Commit fe2b110

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

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pandas/io/tests/json/test_pandas.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,11 @@ def roundtrip(s, encoding='latin-1'):
10111011
for s in examples:
10121012
roundtrip(s)
10131013

1014+
def test_to_json_column_with_empty_dataframe(self):
1015+
# GH 7445
1016+
result = pd.DataFrame({'test': []}, index=[]).to_json(orient='columns')
1017+
expected = '{"test":{}}'
1018+
tm.assert_equal(result, expected)
10141019

10151020
if __name__ == '__main__':
10161021
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb',

0 commit comments

Comments
 (0)