diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2017-02-24 16:04:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-24 16:04:37 -0700 |
commit | 23ac8554b680ae86baf5345af6f18097afe591ce (patch) | |
tree | 35e4c2ef64dec0628917fa9ef1435f84132805aa /numpy/lib/function_base.py | |
parent | 3073627398ed4b4637e9bb8c19a3fe598ffc1680 (diff) | |
parent | 2cd13fec69551b1718763a03c180b85bf820f139 (diff) | |
download | numpy-23ac8554b680ae86baf5345af6f18097afe591ce.tar.gz |
Merge pull request #8688 from madphysicist/patch-1
DOC: Added note to np.diff
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]) |