Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] Add pairwise_diff function #35786

Closed
js8544 opened this issue May 26, 2023 · 0 comments · Fixed by #35787
Closed

[C++] Add pairwise_diff function #35786

js8544 opened this issue May 26, 2023 · 0 comments · Fixed by #35787

Comments

@js8544
Copy link
Collaborator

js8544 commented May 26, 2023

Describe the enhancement requested

Similar to pandas' Series.Diff, the pairwise_diff function computes the first order difference of an array, i.e. output[i] = input[i] - input[i-period] where period is configurable.

Component(s)

C++

bkietz added a commit that referenced this issue Jun 29, 2023
### Rationale for this change

Add a `pairwise_diff` function similar to pandas' [Series.Diff](https://pandas.pydata.org/docs/reference/api/pandas.Series.diff.html), the function computes the first order difference of an array.
### What changes are included in this PR?

I followed [these instructions](#12460 (comment)). The function is implemented for numerical, temporal and decimal types. Chuck arrays are not yet supported.

### Are these changes tested?

Yes. They are tested in vector_pairwise_test.cc and in python/pyarrow/tests/compute.py.

### Are there any user-facing changes?

Yes, and docs are also updated in this PR.

* Closes: #35786

Lead-authored-by: Jin Shang <[email protected]>
Co-authored-by: Benjamin Kietzman <[email protected]>
Signed-off-by: Benjamin Kietzman <[email protected]>
@bkietz bkietz added this to the 13.0.0 milestone Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants