Skip to content

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

@nancy-pm

Description

@nancy-pm

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds InfoClarification about behavior needed to assess issueSortinge.g. sort_index, sort_values

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions