Skip to content

Added test for sort_index parameter multiindex 'sort_remaining' = False #53076

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 6 commits into from
May 6, 2023

Conversation

NoyHanan
Copy link
Contributor

@NoyHanan NoyHanan commented May 4, 2023

@mroeschke
Copy link
Member

Please ensure you run precommit to fix code check issues: https://pandas.pydata.org/docs/development/contributing_codebase.html#contributing-pre-commit

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label May 4, 2023
@NoyHanan
Copy link
Contributor Author

NoyHanan commented May 5, 2023

Hi @mroeschke :)
All the checks have passed.


@pytest.mark.parametrize("ascending", [True, False])
def test_sort_index_multiindex_sort_remaining(self, ascending):
# GH #24247, testing multiindex sort_remaining=false consistent behavior
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the comment except the gh reference

df_sorted = df.sort_index(level=1, sort_remaining=False, ascending=ascending)

if ascending:
df_expected = DataFrame(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you call result and expected?

),
)

# Assert that the resulting DataFrame is sorted correctly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, can remove comment

@NoyHanan
Copy link
Contributor Author

NoyHanan commented May 5, 2023

Hi @phofl
I fixed the code according to your notes, is is ok now?

@phofl
Copy link
Member

phofl commented May 5, 2023

You didn't address any of my comments

@NoyHanan
Copy link
Contributor Author

NoyHanan commented May 6, 2023

You didn't address any of my comments

Sorry, I forgot to commit :)
Now you should see it.

@phofl phofl added this to the 2.1 milestone May 6, 2023
@phofl phofl merged commit 34370ff into pandas-dev:main May 6, 2023
@phofl
Copy link
Member

phofl commented May 6, 2023

thx @NoyHanan

topper-123 pushed a commit to topper-123/pandas that referenced this pull request May 7, 2023
@NoyHanan NoyHanan deleted the test-sort-index branch May 8, 2023 07:08
Rylie-W pushed a commit to Rylie-W/pandas that referenced this pull request May 19, 2023
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sort_index(..., ascending=False, ...) overrides sort_remaining behavior with multiindex
3 participants