summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 6f3a10de4..a88a782b4 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -3797,7 +3797,7 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('put',
add_newdoc('numpy.core.multiarray', 'copyto',
"""
- copyto(dst, src, casting='same_kind', where=None, preservena=False)
+ copyto(dst, src, casting='same_kind', where=None)
Copies values from one array to another, broadcasting as necessary.
@@ -3825,9 +3825,6 @@ add_newdoc('numpy.core.multiarray', 'copyto',
A boolean array which is broadcasted to match the dimensions
of `dst`, and selects elements to copy from `src` to `dst`
wherever it contains the value True.
- preservena : bool, optional
- If set to True, leaves any NA values in `dst` untouched. This
- is similar to the "hard mask" feature in numpy.ma.
""")
@@ -3842,11 +3839,6 @@ add_newdoc('numpy.core.multiarray', 'putmask',
If `values` is not the same size as `a` and `mask` then it will repeat.
This gives behavior different from ``a[mask] = values``.
- .. note:: The `putmask` functionality is also provided by `copyto`, which
- can be significantly faster and in addition is NA-aware
- (`preservena` keyword). Replacing `putmask` with
- ``np.copyto(a, values, where=mask)`` is recommended.
-
Parameters
----------
a : array_like
@@ -4845,14 +4837,15 @@ add_newdoc('numpy.lib._compiled_base', 'digitize',
Parameters
----------
x : array_like
- Input array to be binned. It has to be 1-dimensional.
+ Input array to be binned. Prior to Numpy 1.10.0, this array had to
+ be 1-dimensional, but can now have any shape.
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
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
+ does not include the right edge. The left bin end is open in this
+ case, i.e., bins[i-1] <= x < bins[i] is the default behavior for
monotonically increasing bins.
Returns
@@ -4863,7 +4856,7 @@ add_newdoc('numpy.lib._compiled_base', 'digitize',
Raises
------
ValueError
- If the input is not 1-dimensional, or if `bins` is not monotonic.
+ If `bins` is not monotonic.
TypeError
If the type of the input is complex.
@@ -4877,6 +4870,13 @@ add_newdoc('numpy.lib._compiled_base', 'digitize',
attempting to index `bins` with the indices that `digitize` returns
will result in an IndexError.
+ .. versionadded:: 1.10.0
+
+ `np.digitize` is implemented in terms of `np.searchsorted`. This means
+ that a binary search is used to bin the values, which scales much better
+ for larger number of bins than the previous linear search. It also removes
+ the requirement for the input array to be 1-dimensional.
+
Examples
--------
>>> x = np.array([0.2, 6.4, 3.0, 1.6])
@@ -4893,7 +4893,7 @@ add_newdoc('numpy.lib._compiled_base', 'digitize',
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])
+ >>> 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)