Closed
Description
_________ TestPandasContainer.test_to_json_large_numbers[2147483648] __________
[gw0] win32 -- Python 3.7.7 D:\a\1\s\test_venv\Scripts\python.exe
self = <pandas.tests.io.json.test_pandas.TestPandasContainer object at 0x2C6E2A70>
bigNum = 2147483648
@pytest.mark.parametrize("bigNum", [sys.maxsize + 1, -(sys.maxsize + 2)])
def test_to_json_large_numbers(self, bigNum):
# GH34473
series = Series(bigNum, dtype=object, index=["articleId"])
json = series.to_json()
expected = '{"articleId":' + str(bigNum) + "}"
assert json == expected
# GH 20599
with pytest.raises(ValueError):
json = StringIO(json)
result = read_json(json)
tm.assert_series_equal(series, result)
df = DataFrame(bigNum, dtype=object, index=["articleId"], columns=[0])
json = df.to_json()
expected = '{"0":{"articleId":' + str(bigNum) + "}}"
assert json == expected
# GH 20599
with pytest.raises(ValueError):
json = StringIO(json)
result = read_json(json)
> tm.assert_frame_equal(df, result)
E AssertionError: Attributes of DataFrame.iloc[:, 0] (column name="0") are different
E
E Attribute "dtype" are different
E [left]: object
E [right]: int64
xref #34473.
cc @arw2019.