Skip to content

BUG: Index type casting in read_json with orient='table' and float index #25433

@albertvillanova

Description

@albertvillanova

Code Sample, a copy-pastable example if possible

expected = pd.DataFrame({'a':[5,5]}, index=[1.,2.]) result = pd.read_json(expected.to_json(orient='table'), orient='table')
In [141]: expected Out[141]: a 1.0 5 2.0 5 In [142]: result Out[142]: a 1 5 2 5 

Problem description

Round trip should recover the original DataFrame. But the result index has been cast from float to integer.

Expected Output

The same as expected.

Output of pd.show_versions()

AttributeError: module 'tables' has no attribute 'version'

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDtype ConversionsUnexpected or buggy dtype conversionsIO JSONread_json, to_json, json_normalize

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions