numpy.ediff1d

numpy.ediff1d(ary, to_end=None, to_begin=None)

The differences between consecutive elements of an array.

Parameters:

ary : array

This array will be flattened before the difference is taken.

to_end : number, optional

If provided, this number will be tacked onto the end of the returned differences.

to_begin : number, optional

If provided, this number will be taked onto the beginning of the returned differences.

Returns:

ed : array

The differences. Loosely, this will be (ary[1:] - ary[:-1]).

Notes

When applied to masked arrays, this function drops the mask information if the to_begin and/or to_end parameters are used

Previous topic

numpy.diff

Next topic

numpy.gradient

This Page

Quick search