Update README.md

Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
David Rotermund 2023-12-15 00:41:56 +01:00 committed by GitHub
parent 791f2e3f82
commit 905809396f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,6 +23,71 @@ print(b) # -> 1.0
## [numpy.ndarray.fill](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.fill.html)
```python
ndarray.fill(value)
```
> Fill the array with a scalar value.
```python
import numpy as np
A = np.ones((3, 3))
A.fill(7)
print(A)
```
Output:
```python
[[7. 7. 7.]
[7. 7. 7.]
[7. 7. 7.]]
```
## [numpy.ndarray.ndim](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.ndim.html)
```python
ndarray.ndim
```
> Number of array dimensions.
```python
import numpy as np
A = np.ones((3, 3))
print(A.ndim) # -> 2
```
## [numpy.ndarray.shape](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.shape.html)
```python
ndarray.shape
```
> Tuple of array dimensions.
```python
import numpy as np
A = np.ones((3, 3))
print(A.shape) # -> (3, 3)
```
## [numpy.ndarray.size](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.size.html)
```python
ndarray.size
```
> Number of elements in the array.
```python
import numpy as np
A = np.ones((3, 3))
print(A.size) # -> 9
```
## [Array methods](https://numpy.org/doc/stable/reference/arrays.ndarray.html#array-methods)