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

Unexpected behaviour with pd.filter in pandas 2.1 #55195

Closed
3 tasks done
shuai-b-zhang opened this issue Sep 19, 2023 · 3 comments
Closed
3 tasks done

Unexpected behaviour with pd.filter in pandas 2.1 #55195

shuai-b-zhang opened this issue Sep 19, 2023 · 3 comments
Labels
Bug Duplicate Report Duplicate issue or pull request Needs Info Clarification about behavior needed to assess issue Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@shuai-b-zhang
Copy link

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

ban = df_merged.filter([col2, col4, col3])

Issue Description

I'm user of Padans, I found a issue, when I update to 2.1.
We have some dataframe with the following columns:

col1, col2, col3, col4

We want to filter for a subset of those columns:

note the ordering: 2, 4, 3

ban = df_merged.filter([col2, col4, col3])

However, in 2.1, the function returns the columns in the dataframe ordering:

col2, col3, col4

Expected Behavior

In 1.5, the function would return the columns in the order we passed them in as:

col2, col4, col3

Installed Versions

2.1

@shuai-b-zhang shuai-b-zhang added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 19, 2023
@rhshadrach
Copy link
Member

rhshadrach commented Sep 19, 2023

Thanks for the report - can you:

  • Give a descriptive title to this issue (right now it is just BUG:)
  • Give a reproducible example - it needs to be something anyone investigating this issue can run
  • Tell the full version of pandas you are using. Are you using 2.1.0 or 2.1.1? Whoops 2.1.1 hasn't been released yet!

@rhshadrach rhshadrach added the Needs Info Clarification about behavior needed to assess issue label Sep 19, 2023
@rhshadrach
Copy link
Member

This is likely a duplicate of #55075

@shuai-b-zhang
Copy link
Author

@rhshadrach thanks your quickly reply, sorry for raise duplicate issue. it is same with #55075

@shuai-b-zhang shuai-b-zhang changed the title BUG: Unexpected behaviour with pd.filter in pandas 2.1 Sep 19, 2023
@rhshadrach rhshadrach added the Duplicate Report Duplicate issue or pull request label Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request Needs Info Clarification about behavior needed to assess issue Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants