Update README.md

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

View file

@ -212,3 +212,28 @@ Output:
[ 0 0 0]]
```
## x and y are matricies
x and y (if both are matricies) need the same size as the conditon has.
```python
import numpy as np
a = np.arange(0, 15).reshape((5, 3))
b = np.arange(15, 30).reshape((5, 3))
c = np.arange(30, 45).reshape((5, 3))
a = np.where(a > 7, b, c)
print(a)
```
Output:
```python
[[30 31 32]
[33 34 35]
[36 37 23]
[24 25 26]
[27 28 29]]
```