Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column ordering is not preserved #17

Closed
amirouche opened this issue Dec 14, 2017 · 1 comment
Closed

Column ordering is not preserved #17

amirouche opened this issue Dec 14, 2017 · 1 comment
Labels

Comments

@amirouche
Copy link

At least before Python 3.7 column ordering is not kept. I am new to the field of data science and data engineering. I am wondering whether column order is significant in a table.

WDYT?

@reubano
Copy link
Owner

reubano commented Dec 18, 2017

Hi @amirouche, dictionary order is considered an implementation detail and not relevant for most use cases. If you require a specific order, you can use collections.OrderedDict.

records = [{'a': 1, 'b': 2}, {'a': 3, 'b': 4}]
[OrderedDict(sorted(r.items(), key=lambda t: t[0])) for r in records]

@reubano reubano closed this as completed Dec 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants