You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Python 3.6 dicts have for practical purposes been ordered by insertion order in CPython, and from Cpython 3.7 dicts will be formally ordered by insertion order in the language specs.
Pandas currently orders series/dataframe comstructed from dict alphabetically. I propose to make the sort order dependent on python version, so Python <3.6 will keep the current behavior, while Python >= 3.6 will use insertion order.
I have played a bit with this and the code changes seem to be minimal (change a line in _init_dict in each of series.py/frame.py). After making the changes only 36 tests are failing, which is good. Updating the tests will mainly consists of making the columns order fixed in places (i.e. add a columns=[...] for dataframes and index=[...] for series), so I predict this would not be a huge PR.
I could take this on, if there's agreement.
EDIT: Ok, sparse/frame.py will also have its _init_dict changed, but still I think this will be a small code change.
The text was updated successfully, but these errors were encountered:
Since Python 3.6 dicts have for practical purposes been ordered by insertion order in CPython, and from Cpython 3.7 dicts will be formally ordered by insertion order in the language specs.
Pandas currently orders series/dataframe comstructed from dict alphabetically. I propose to make the sort order dependent on python version, so Python <3.6 will keep the current behavior, while Python >= 3.6 will use insertion order.
I have played a bit with this and the code changes seem to be minimal (change a line in
_init_dict
in each ofseries.py
/frame.py
). After making the changes only 36 tests are failing, which is good. Updating the tests will mainly consists of making the columns order fixed in places (i.e. add acolumns=[...]
for dataframes andindex=[...]
for series), so I predict this would not be a huge PR.I could take this on, if there's agreement.
EDIT: Ok,
sparse/frame.py
will also have its_init_dict
changed, but still I think this will be a small code change.The text was updated successfully, but these errors were encountered: