Skip to content

Commit a9ec3fa

Browse files
committed
Changed for compatibility. Python=3.5 needs sort.
1 parent ae19e6c commit a9ec3fa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/core/internals/construction.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pandas._libs import lib
1111
from pandas._libs.tslibs import IncompatibleFrequency, OutOfBoundsDatetime
1212
from pandas.compat import raise_with_traceback
13+
import pandas.compat as compat
1314

1415
from pandas.core.dtypes.cast import (
1516
construct_1d_arraylike_from_scalar, construct_1d_ndarray_preserving_na,
@@ -291,6 +292,8 @@ def extract_index(data):
291292
indexes.append(val.index)
292293
elif isinstance(val, dict):
293294
have_dicts = True
295+
if isinstance(val, OrderedDict):
296+
have_ordered = True
294297
indexes.append(list(val.keys()))
295298
elif is_list_like(val) and getattr(val, 'ndim', 1) == 1:
296299
have_raw_arrays = True
@@ -303,7 +306,8 @@ def extract_index(data):
303306
if have_series:
304307
index = _union_indexes(indexes)
305308
elif have_dicts:
306-
index = _union_indexes(indexes, sort=False)
309+
index = _union_indexes(indexes,
310+
sort=not (compat.PY36 or have_ordered))
307311

308312
if have_raw_arrays:
309313
lengths = list(set(raw_lengths))

0 commit comments

Comments
 (0)