1
0
Fork 0
mirror of https://github.com/davrot/pytutorial.git synced 2025-04-19 05:36:42 +02:00

Update README.md

Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
David Rotermund 2023-12-30 18:02:15 +01:00 committed by GitHub
parent 4ebc3a4f5f
commit 845b03e54b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.