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

Inconsistent column ordering from dfw.to_frame(columns) #57

Open
smmaurer opened this issue Apr 27, 2022 · 0 comments
Open

Inconsistent column ordering from dfw.to_frame(columns) #57

smmaurer opened this issue Apr 27, 2022 · 0 comments

Comments

@smmaurer
Copy link
Member

smmaurer commented Apr 27, 2022

Writing up a column ordering glitch. I've only half looked into this, so some of the details may be wrong.

Calling DataFrameWrapper.to_frame(column_list), if the columns you ask for are in the core table then they are returned in the order listed. But if they are computed columns then the order varies at random.

Here's the function: orca.py#L372.

This is annoying and I can't think of a reason not to make it deterministic. I think this might be a "new" behavior in that it was not originally intended but the way Python handles some underlying data structure changed at some point to cause this.

A work-around is to use DataFrameWrapper.to_frame(column_list)[column_list] when a consistent order is needed. (Although Orca fails gracefully if items from column_list are not defined, while the work-around does not.)

Relatedly, I see in the code that the computed columns are also generated in a random order, which might occasionally cause inconsistent outcomes that would not be controlled by a NumPy random seed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant