Skip to content

[SPARK-46161][PS] Add axis=1 support for DataFrame.diff#54516

Open
devin-petersohn wants to merge 1 commit intoapache:masterfrom
devin-petersohn:devin/diff-axis-columns
Open

[SPARK-46161][PS] Add axis=1 support for DataFrame.diff#54516
devin-petersohn wants to merge 1 commit intoapache:masterfrom
devin-petersohn:devin/diff-axis-columns

Conversation

@devin-petersohn
Copy link
Contributor

What changes were proposed in this pull request?

Implement column-wise differencing for DataFrame.diff(axis=1).

Why are the changes needed?

It is a missing pandas API parameter.

Does this PR introduce any user-facing change?

Yes, DataFrame.diff(axis=1) now works.

How was this patch tested?

CI

Was this patch authored or co-authored using generative AI tooling?

Co-authored-by: Claude Opus 4

Co-authored-by: Devin Petersohn <devin.petersohn@snowflake.com>
Signed-off-by: Devin Petersohn <devin.petersohn@gmail.com>
Copy link
Contributor

@holdenk holdenk left a comment

Choose a reason for hiding this comment

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

LGTM

DataFrame (default is the element in the same column of the previous row).

.. note:: the current implementation of diff uses Spark's Window without
.. note:: When ``axis=0``, the current implementation of diff uses Spark's Window without
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: but this seems like we should file a JIRA for this and fix it in a follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants