summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2006-09-03 02:26:26 +0000
committerCharles Harris <charlesr.harris@gmail.com>2006-09-03 02:26:26 +0000
commit6f31fbc4da05ddaec34fde5cd455b5028e60b355 (patch)
tree289e82844feee7388ef07f2e4b7de79fb1a7f13f /numpy/add_newdocs.py
parent92abb2700078ae4a4e1da4df8a075e3134a86216 (diff)
downloadnumpy-6f31fbc4da05ddaec34fde5cd455b5028e60b355.tar.gz
Add new keyword <side> to the searchsorted method and function.
Add documentation thereto. Cleanup whitespace.
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py39
1 files changed, 33 insertions, 6 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 076d61b6c..2dcc8ca23 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -819,13 +819,40 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('round',
add_newdoc('numpy.core.multiarray', 'ndarray', ('searchsorted',
-"""a.searchsorted(v)
+"""a.searchsorted(values=v, side='left') -> array of indices.
- Assuming that a is a 1-D array, in ascending order and represents bin
- boundaries, then a.searchsorted(values) gives an array of bin numbers,
- giving the bin into which each value would be placed. This method is
- helpful for histograming. Note: No warning is given if the boundaries, in
- a, are not in ascending order.
+ Required Arguments:
+ v -- keys to be searched for in a.
+
+ Keyword arguments
+ side -- {'left', 'right'}, default('left').
+
+ If a is a 1-D array in ascending order, then
+
+ a.searchsorted(v, side='left')
+
+ returns an array of indices i such that for each element of values the
+ following holds:
+
+ a[j] < key <= a[i] for all j < i,
+
+ If such an index does not exist, a.size() is used. The result is such that
+ if the key were to be inserted in the slot before the index i, then the
+ order of a would be preserved and i would be the smallest index with that
+ property.
+
+ If a is a 1-D array in ascending order, then
+
+ a.searchsorted(v, side='right')
+
+ returns an array of indices i such that for each element of values the
+ following holds:
+
+ a[j] <= key < a[i] for all j < i,
+
+ If such an index does not exist, a.size() is used. The result is that if the
+ key were to be inserted in the slot before the index i, then the order of a
+ would be preserved and i would be the largest index with that property.
"""))