Fix to_pandas() row-doubling when names is set and mcols has no matching row names - #165
Closed
mjsteinbaugh wants to merge 1 commit into
Closed
Fix to_pandas() row-doubling when names is set and mcols has no matching row names#165mjsteinbaugh wants to merge 1 commit into
mjsteinbaugh wants to merge 1 commit into
Conversation
Member
|
Thank you for the PR. I already started working on this in #164, which also fixes a polars related issue. I would close this since the changes here are already fixed in the other PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #163.
to_pandas()set_rdf.indextoself._namesbefore concatenatingself._mcols.to_pandas(), whose index was still the default positionalRangeIndex.pandas.concat(axis=1)then outer-joined on the two disjoint indices instead of binding columns positionally, doubling the row count and NaN-splitting every row.This moves the index assignment to after the
mcolsconcat, matchingIRanges.to_pandas()in the siblingirangespackage, which already does it in this order and is unaffected.Added a regression test (
test_to_pandas_with_names_and_mcols_is_positional) using the exact repro from the issue. Ran the full existing test suite locally against the patched source: 100 passed, 1 unrelated skip, no new failures (tests/test_gr_initialize_polars.pyexcluded,polarsnot available in my environment, unrelated to this change).