summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorJoseph Fox-Rabinovitz <madphysicist@users.noreply.github.com>2017-02-24 17:08:56 -0500
committerGitHub <noreply@github.com>2017-02-24 17:08:56 -0500
commit2cd13fec69551b1718763a03c180b85bf820f139 (patch)
tree06853b59392297b6288f62db1ca3163bead4d687 /numpy/lib/function_base.py
parent5f5ccecbfc116284ed8c8d53cd8b203ceef5f7c7 (diff)
downloadnumpy-2cd13fec69551b1718763a03c180b85bf820f139.tar.gz
DOC: Added note to np.diff
Also noted that type is preserved. [ci skip]
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index fc49a6fd7..a00ee8338 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])