Json import sorting
See original GitHub issueNoticed that if export a df to json file and then reload the data, ordering is not kept.
import pandas as pd
df.to_json('test.json')
newdf = pd.read_json('test.json')
print df.index
gives:
1
10
100
....
instead of
1
2
3
....
it suffices to call newdf = pd.read_json('test.json').sort()
to have the what I’d expect.
Is this intended behaviour or bug?
Issue Analytics
- State:
- Created 10 years ago
- Comments:22 (22 by maintainers)
Top Results From Across the Web
How to sort JSON objects in Python - Linux Hint
The JSON object can be sorted by using built-in python functions, modules, and user-defined functions. ... Import the JSON module import json
Read more >sort-json - npm
Takes a json-file and return a copy of the same file, but sorted. Latest version: 2.0.1, last published: 10 months ago.
Read more >Sort data when using ImportJSON - Stack Overflow
You can't sort data before you load it, the original data is in JSON format anyways. JSON contains a un-ordered collection of name/value...
Read more >Sorting your imports with ESLint - DEV Community
Package imports should come next, sorted by alphabetical order; The named imports should be sorted in alphabetical order; It should skip a line ......
Read more >Python | Sort JSON by value - GeeksforGeeks
The task is to sort the JSON first by code, then by grade and then by enrollment_no . Code #1: Sorting in Desc...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
BTW @ghego if you want to ensure that order is preserved during roudtrip JSONifying try using
orient=split
@jreback #5287 eventually got there. Thanks for the reminders.