8000 Merge pull request #8688 from madphysicist/patch-1 · numpy/numpy@23ac855 · GitHub
[go: up one dir, main page]

Skip to content

Commit 23ac855

Browse files
authored
Merge pull request #8688 from madphysicist/patch-1
DOC: Added note to np.diff
2 parents 3073627 + 2cd13fe commit 23ac855

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

numpy/lib/function_base.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1872,12 +1872,19 @@ def diff(a, n=1, axis=-1):
18721872
-------
18731873
diff : ndarray
18741874
The n-th differences. The shape of the output is the same as `a`
1875-
except along `axis` where the dimension is smaller by `n`.
1875+
except along `axis` where the dimension is smaller by `n`. The
1876+
type of the output is the same as that of the input.
18761877
18771878
See Also
18781879
--------
18791880
gradient, ediff1d, cumsum
18801881
1882+
Notes
1883+
-----
1884+
For boolean arrays, the preservation of type means that the result
1885+
will contain `False` when consecutive elements are the same and
1886+
`True` when they differ.
1887+
18811888
Examples
18821889
--------
18831890
>>> x = np.array([1, 2, 4, 7, 0])

0 commit comments

Comments
 (0)
0