summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorSkipper Seabold <jsseabold@gmail.com>2012-04-03 22:52:11 -0400
committerSkipper Seabold <jsseabold@gmail.com>2012-04-03 22:52:26 -0400
commitd1d7a158970d39aef56e10352efc559bd543e5c8 (patch)
tree4e827d57c1a565de9e78b0b6614b9dec0b4b4f1d /numpy/add_newdocs.py
parent0488f85de8a9ec3755198f57d40e9b091ca2aaee (diff)
downloadnumpy-d1d7a158970d39aef56e10352efc559bd543e5c8.tar.gz
DOC: Clarify digitize docs and add example
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 185fb7425..dabbf9ab4 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -4884,11 +4884,11 @@ add_newdoc('numpy.lib._compiled_base', 'digitize',
bins : array_like
Array of bins. It has to be 1-dimensional and monotonic.
right : bool, optional
- Indicating whether the intervals include the right or the left bin.
- Default behavior is (right==False) indicating that the interval
- includes the left bin and is open on the right. Ie.,
- bins[i-1] <= x < bins[i] is the default behavior for monotonically
- increasing bins.
+ Indicating whether the intervals include the right or the left bin
+ edge. Default behavior is (right==False) indicating that the interval
+ does not include the right edge. The left bin and is open in this
+ case. Ie., bins[i-1] <= x < bins[i] is the default behavior for
+ monotonically increasing bins.
Returns
-------
@@ -4927,6 +4927,12 @@ add_newdoc('numpy.lib._compiled_base', 'digitize',
2.5 <= 3.0 < 4.0
1.0 <= 1.6 < 2.5
+ >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.])
+ >>> bins = np.array([0,5,10,15,20])
+ >>> np.digitize(x,bins,right=True)
+ array([1, 2, 3, 4, 4])
+ >>> np.digitize(x,bins,right=False)
+ array([1, 3, 3, 4, 5])
""")
add_newdoc('numpy.lib._compiled_base', 'bincount',