Fix render reorder causing incorrect groupings #218
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, Great Tables keeps a GT._body.body dataframe, ordered to match the final output (e.g. sorted by group). This means that what happens currently looks like this:
._body.body
reordered to match final outputHowever, there are two issues with this:
_body.body
when rendering html, as if the dataframe hasn't been sorted. (but it has).In order to fix this, we need to decide whether
_body.body
should be sorted, and make sure it's filled consistently across pandas and polars.This PR simply removes the sorting of
_body.body
. Since we index based on the original data (e.g. passingrow=1
to a formatter refers to that row position in the original, unsorted data), it seems like we can avoid sorting._body.body
, and just grab the correctly ordered rows when rendering.(Note that the snapshot test I added when addressing #201 was wrong 馃槶, and I fixed it here)
Fixes: #98