Skip to content

Commit 101b4d2

Browse files
committed
fix unnecessary sort
1 parent 4fb853f commit 101b4d2

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

pandas/core/indexes/api.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,10 @@ def _union_indexes(indexes, sort=True):
169169
if len(indexes) == 1:
170170
result = indexes[0]
171171
if isinstance(result, list):
172-
result = Index(sorted(result))
172+
if sort:
173+
result = Index(sorted(result))
174+
else:
175+
result = Index(result)
173176
return result
174177

175178
indexes, kind = _sanitize_and_check(indexes)

pandas/io/json/_json.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -1112,14 +1112,10 @@ def _parse_no_numpy(self):
11121112
self.check_keys_split(decoded)
11131113
self.obj = DataFrame(dtype=None, **decoded)
11141114
elif orient == "index":
1115-
self.obj = (
1116-
DataFrame.from_dict(
1117-
loads(json, precise_float=self.precise_float),
1118-
dtype=None,
1119-
orient="index",
1120-
)
1121-
.sort_index(axis="columns")
1122-
.sort_index(axis="index")
1115+
self.obj = DataFrame.from_dict(
1116+
loads(json, precise_float=self.precise_float),
1117+
dtype=None,
1118+
orient="index",
11231119
)
11241120
elif orient == "table":
11251121
self.obj = parse_table_schema(json, precise_float=self.precise_float)

0 commit comments

Comments
 (0)