Skip to content

Ordering should be kept when OrderedDict records are passed #10056

Closed
@Zaharid

Description

@Zaharid

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')

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions