[SPARK-46160][PYTHON] Add axis parameter to DataFrame.shift in pandas API on Spark#55545
Open
devin-petersohn wants to merge 2 commits intoapache:masterfrom
Open
[SPARK-46160][PYTHON] Add axis parameter to DataFrame.shift in pandas API on Spark#55545devin-petersohn wants to merge 2 commits intoapache:masterfrom
devin-petersohn wants to merge 2 commits intoapache:masterfrom
Conversation
… API on Spark Co-Authored-By: Claude <noreply@anthropic.com>
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?
Add
axisparameter toDataFrame.shift()in the pandas API on Spark.axis=1shifts values across columns using apandas_udf, with a fast path for small DataFrames following thecompute.shortcut_limitpattern.Why are the changes needed?
pandas
DataFrame.shift()supportsaxis=1but the pandas API on Spark did not.Does this PR introduce any user-facing change?
Yes.
DataFrame.shift()now acceptsaxis(0,1,'index','columns'). Default behavior is unchanged.How was this patch tested?
Added
test_shift_axiscovering axis=0/1, string aliases, various periods, fill_value, single-column, NaN values, multi-index columns, large dataset (UDF path), mixed types, empty DataFrame, and invalid axis.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (claude-opus-4-6)