[SPARK-46158][PYTHON][PS] Support axis columns in DataFrame.xs#56284
Open
manhha2502 wants to merge 1 commit into
Open
[SPARK-46158][PYTHON][PS] Support axis columns in DataFrame.xs#56284manhha2502 wants to merge 1 commit into
manhha2502 wants to merge 1 commit into
Conversation
a3eef60 to
a01852f
Compare
a01852f to
7da11c0
Compare
Member
|
cc @devin-petersohn fyi |
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.
What changes were proposed in this pull request?
This PR adds support for
DataFrame.xswithaxis=1/axis="columns"in pandas API on Spark.It supports selecting cross-sections from columns, including single-level columns, MultiIndex columns, and level-based selection by level number or level name.
Why are the changes needed?
DataFrame.xscurrently supports index-axis selection, but column-axis selection raisesNotImplementedError.This improves compatibility with pandas and addresses SPARK-46158.
Does this PR introduce any user-facing change?
Yes.
Previously,
DataFrame.xs(..., axis=1)raisedNotImplementedError.After this change, users can select column cross-sections, for example:
How was this patch tested?
Added positive and negative test cases in
FrameIndexingMixin.test_xscoveringaxis=1,axis="columns", MultiIndex columns, level-based selection, missing column keys, and invalid column levels.Also ran:
I attempted to run the targeted unittest locally, but the source checkout has not built Spark jars yet.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex (GPT-5)