diff options
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index bee60fa20..95d754403 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1872,12 +1872,19 @@ def diff(a, n=1, axis=-1): ------- diff : ndarray The n-th differences. The shape of the output is the same as `a` - except along `axis` where the dimension is smaller by `n`. + except along `axis` where the dimension is smaller by `n`. The + type of the output is the same as that of the input. See Also -------- gradient, ediff1d, cumsum + Notes + ----- + For boolean arrays, the preservation of type means that the result + will contain `False` when consecutive elements are the same and + `True` when they differ. + Examples -------- >>> x = np.array([1, 2, 4, 7, 0]) |