Commits


Jin Shang authored and GitHub committed 26c25d1b06d
GH-35786: [C++] Add pairwise_diff function (#35787) ### 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](https://github.com/apache/arrow/pull/12460#issuecomment-1057520554). 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 <shangjin1997@gmail.com> Co-authored-by: Benjamin Kietzman <bengilgit@gmail.com> Signed-off-by: Benjamin Kietzman <bengilgit@gmail.com>