numpy.ediff1d()

numpy.ediff1d

numpy.ediff1d(ary, to_end=None, to_begin=None) [source]

The differences between consecutive elements of an array.

Parameters:

ary : array_like

If necessary, will be flattened before the differences are taken.

to_end : array_like, optional

Number(s) to append at the end of the returned differences.

to_begin : array_like, optional

Number(s) to prepend at the beginning of the returned