pyarrow.compute.pairwise_diff(input, /, period=1, *, options=None, memory_pool=None)

Compute first order difference of an array.

Computes the first order difference of an array, It internally calls the scalar function “subtract” to compute

differences, so its

behavior and supported types are the same as “subtract”. The period can be specified in :struct:`PairwiseOptions`.

Results will wrap around on integer overflow. Use function “pairwise_diff_checked” if you want overflow to return an error.


Argument to compute function.

periodint, default 1

Period for applying the period function.

optionspyarrow.compute.PairwiseOptions, optional

Alternative way of passing options.

memory_poolpyarrow.MemoryPool, optional

If not passed, will allocate memory from the default memory pool.