Skip to content

Commit

Permalink
PERF: 5x speedup for read_json() with orient='index' by avoiding tran…
Browse files Browse the repository at this point in the history
…spose
  • Loading branch information
qwhelan committed Jul 8, 2019
1 parent 65e123c commit d77a2a2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pandas/io/json/_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,9 +1085,11 @@ def _parse_no_numpy(self):
self.check_keys_split(decoded)
self.obj = DataFrame(dtype=None, **decoded)
elif orient == "index":
self.obj = DataFrame(
loads(json, precise_float=self.precise_float), dtype=None
).T
self.obj = DataFrame.from_dict(
loads(json, precise_float=self.precise_float),
dtype=None,
orient="index",
).sort_index(axis="columns")
elif orient == "table":
self.obj = parse_table_schema(json, precise_float=self.precise_float)
else:
Expand Down

0 comments on commit d77a2a2

Please sign in to comment.