Skip to content

BUG: Fix sorting by column named None in DataFrame.sort_values (GH#61512) #61517

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

Merged
merged 1 commit into from
Jun 2, 2025

Conversation

iabhi4
Copy link
Contributor

@iabhi4 iabhi4 commented May 30, 2025

Fixes a bug in DataFrame.sort_values where sorting by a column explicitly named None raised a KeyError. Added a conditional check to correctly retrieve and sort the column when None is used as a label.

@iabhi4 iabhi4 force-pushed the fix/sort-by-none-column branch 3 times, most recently from 39aecc7 to 4244b96 Compare May 30, 2025 02:08
@iabhi4 iabhi4 force-pushed the fix/sort-by-none-column branch from 4244b96 to 488423b Compare May 30, 2025 18:07
@iabhi4 iabhi4 requested a review from mroeschke May 30, 2025 18:09
@iabhi4 iabhi4 force-pushed the fix/sort-by-none-column branch from 488423b to 9d71f50 Compare May 30, 2025 18:13
@iabhi4 iabhi4 force-pushed the fix/sort-by-none-column branch from 9d71f50 to e6e33c4 Compare May 30, 2025 21:44
@iabhi4 iabhi4 requested a review from mroeschke May 30, 2025 23:43
@mroeschke mroeschke added the Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff label Jun 2, 2025
@mroeschke mroeschke added this to the 3.0 milestone Jun 2, 2025
@mroeschke mroeschke merged commit 279f597 into pandas-dev:main Jun 2, 2025
47 checks passed
@mroeschke
Copy link
Member

Thanks @iabhi4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Cannot sort by columns named None
2 participants