From 845b03e54b4ad00218f5ca7198c377819bb3b022 Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Sat, 30 Dec 2023 18:02:15 +0100 Subject: [PATCH] Update README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- numpy/merging/README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/numpy/merging/README.md b/numpy/merging/README.md index b8765f1..be6921e 100644 --- a/numpy/merging/README.md +++ b/numpy/merging/README.md @@ -155,3 +155,37 @@ Output: [ 3 4 25] [ 6 17 8]] ``` + +## [numpy.place](https://numpy.org/doc/stable/reference/generated/numpy.place.html) and [numpy.extract](https://numpy.org/doc/stable/reference/generated/numpy.extract.html) and [numpy.copyto](https://numpy.org/doc/stable/reference/generated/numpy.copyto.html) + +```python +numpy.place(arr, mask, vals) +``` + +> Change elements of an array based on conditional and input values. +> +> Similar to np.copyto(arr, vals, where=mask), the difference is that place uses the first N elements of vals, where N is the number of True values in mask, while copyto uses the elements where mask is True. +> +> Note that extract does the exact opposite of place. + + +```python +numpy.extract(condition, arr) +``` + +> Return the elements of an array that satisfy some condition. +> +> This is equivalent to np.compress(ravel(condition), ravel(arr)). If condition is boolean np.extract is equivalent to arr[condition]. +> +> Note that place does the exact opposite of extract. + + +```python +numpy.copyto(dst, src, casting='same_kind', where=True) +``` + +> Copies values from one array to another, broadcasting as necessary. +> +> Raises a TypeError if the casting rule is violated, and if where is provided, it selects which elements to copy. + +