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

BUG: Sorting fails in specific cases with pandas==2.1.1 #61068

Open
2 of 3 tasks
nancy-pm opened this issue Mar 6, 2025 · 3 comments
Open
2 of 3 tasks

BUG: Sorting fails in specific cases with pandas==2.1.1 #61068

nancy-pm opened this issue Mar 6, 2025 · 3 comments
Labels
Bug Needs Info Clarification about behavior needed to assess issue Sorting e.g. sort_index, sort_values

Comments

@nancy-pm
Copy link

nancy-pm commented Mar 6, 2025

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

import pandas as pd

# Example data
data = {'A': [3, 1, 2], 'B': ['x', 'y', 'z']}
df = pd.DataFrame(data)

# Sorting operation
sorted_df = df.sort_values(by='A')
print(sorted_df)

Issue Description

I’ve encountered an issue where sorting operations fail under specific conditions when using pandas==2.1.1. This behavior does not occur in pandas==1.5.3, which suggests it might be a regression or a bug introduced in newer versions.

Expected Behavior

Additional Context:

This issue does not occur in pandas==1.5.3.
I’ve tested this in multiple environments and confirmed the behavior.
If more details are needed, I can provide additional examples or data.
Tips for Submitting an Issue:

Be Clear and Concise: Clearly describe the problem and steps to reproduce it.
Provide Code and Data: Include a minimal reproducible example to help developers debug the issue.
Check for Duplicates: Before submitting, search the Pandas Issues to ensure it hasn’t already been reported.
Be Polite and Professional: Open-source maintainers appreciate respectful and constructive feedback.

Installed Versions

Environment:

Python version: [e.g., 3.9.12]
Pandas version: 2.1.1
Operating System: [ Windows 10]

@nancy-pm nancy-pm added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 6, 2025
@nancy-pm
Copy link
Author

nancy-pm commented Mar 6, 2025

Currently, the output appears correct, but I’d like to ensure there are no edge cases or hidden issues.

Environment:

Python version: [e.g., 3.9.12]
Pandas version: 2.1.1
Operating System: [e.g., Windows 10, macOS, Linux]
Additional Context:

This request is prompted by reports of sorting-related issues in other methods (e.g., sort_values) in pandas==2.1.1.
A thorough review of sort_index would help ensure its reliability across all use cases.
If needed, I can provide additional test cases or data.

@Liam3851
Copy link
Contributor

Liam3851 commented Mar 6, 2025

Note that pandas 2.1.1 is not the latest release, that is pandas 2.2.3.

If you have an example of code that does not work please submit it for reproduction, as it is very difficult to diagnose a bug where, as you state, the output currently appears correct.

@rhshadrach
Copy link
Member

@nancy-pm - can you post the output you believe is incorrect.

@rhshadrach rhshadrach added Needs Info Clarification about behavior needed to assess issue Sorting e.g. sort_index, sort_values and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Info Clarification about behavior needed to assess issue Sorting e.g. sort_index, sort_values
Projects
None yet
Development

No branches or pull requests

3 participants