Ordering should be kept when OrderedDict records are passed · Issue #10056 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
When passing a list OrderedDict objects to pd.DataFrame
, the ordering of the columns is not kept:
od = OrderedDict([('Z', 5), ('xx', 8), ('uno', 2), ('etc', 1), ('j', 76), ('e', 7)]) l = [od]*4 pd.DataFrame(l).columns #Out[23]: Index(['Z', 'e', 'etc', 'j', 'uno', 'xx'], dtype='object')