Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
read_json with table='orient' causes unexpected type coercion #21345
Code Sample, a copy-pastable example if possible
import pandas as pd df = pd.DataFrame([[1., 2., 3.], [1., 2., 3.], [1., 2., 3.]], columns=['a', 'b', 'c']) out = df.to_json(orient='table') result = pd.read_json(out, orient='table') pd.testing.assert_frame_equal(df, result)
Assertion fails with error:
Error is related to this method: https://github.com/pandas-dev/pandas/blob/master/pandas/io/json/json.py#L659
Expected result is passing assertion. Original DF and the JSON round-tripped DF should have same dtype.