Skip to content

TST: Adds test coverage for pd.read_json index type #53242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pandas/tests/io/json/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,16 @@ def test_read_json_table_dtype_raises(self, dtype):
with pytest.raises(ValueError, match=msg):
read_json(dfjson, orient="table", dtype=dtype)

@pytest.mark.parametrize("orient", ["index", "columns", "records", "values"])
def test_read_json_table_empty_axes_dtype(self, orient):
# GH28558

expected = DataFrame()
result = read_json("{}", orient=orient, convert_axes=True)

tm.assert_index_equal(result.index, expected.index)
tm.assert_index_equal(result.columns, expected.columns)

def test_read_json_table_convert_axes_raises(self):
# GH25433 GH25435
df = DataFrame([[1, 2], [3, 4]], index=[1.0, 2.0], columns=["1.", "2."])
Expand Down