Skip to content

BUG: Fix sort_values bug that creates unprintable object #39464

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 9 commits into from
Feb 4, 2021

Conversation

zitorelova
Copy link
Contributor

@zitorelova zitorelova commented Jan 29, 2021

The problem occurs when sorting on columns and the ignore_index parameter is set to True. sort_values tries to refit the index after the columns have been sorted resulting in a corrupted dataframe.

@pep8speaks
Copy link

pep8speaks commented Jan 29, 2021

Hello @zitorelova! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-02-03 14:54:59 UTC

@jbrockmendel
Copy link
Member

needs a test

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

pls add a test and a whatsnew note in reshaping bug fixes for 1.3

@jreback jreback added Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Feb 2, 2021
n_rows = 4

random_state = np.random.RandomState(seed=42)
test_dict = {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you just use a fixed input, so we can directly use assert_frame_equal on the results and compare it exactly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've simplified the test so that it only uses fixed inputs.

@jreback jreback added this to the 1.3 milestone Feb 3, 2021
@jreback
Copy link
Contributor

jreback commented Feb 3, 2021

precommit is failing

@zitorelova
Copy link
Contributor Author

precommit is passing now

@zitorelova
Copy link
Contributor Author

zitorelova commented Feb 3, 2021

Seems to be a ResourceWarning causing one of the checks to fail. Is this related?

@jreback jreback merged commit 34191dd into pandas-dev:master Feb 4, 2021
@jreback
Copy link
Contributor

jreback commented Feb 4, 2021

thanks @zitorelova

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: sort_values create an unprintable object
4 participants