... | ... | @@ -72,34 +72,36 @@ Mayer](https://www.amazon.com/Coffee-Break-NumPy-Science-Mastery/dp/1076932614). |
|
|
|
|
|
**Creating Arrays**
|
|
|
|
|
|
```Python
|
|
|
```python
|
|
|
array_size = 8
|
|
|
zeroes_array = np.zeros(array_size)
|
|
|
print(zeroes_array)
|
|
|
print()
|
|
|
```
|
|
|
|
|
|
```Python
|
|
|
```python
|
|
|
array_size = 12
|
|
|
ones_array = np.ones(array_size)
|
|
|
print(ones_array)
|
|
|
print()
|
|
|
```
|
|
|
|
|
|
```Python
|
|
|
```python
|
|
|
# Contents are "whatever happens to be in memory"
|
|
|
array_size = 16
|
|
|
unitialized_array = np.empty(array_size)
|
|
|
print(unitialized_array)
|
|
|
print()
|
|
|
# Create two NumPy arrays from Python lists
|
|
|
```
|
|
|
|
|
|
```python
|
|
|
python_list = [2, 4, 8, 16, 32, 64]
|
|
|
np_array = np.array(python_list)
|
|
|
print(np_array)
|
|
|
print()
|
|
|
```
|
|
|
|
|
|
```Python
|
|
|
```python
|
|
|
python_list = [2., 4., 8., 16., 32., 64.]
|
|
|
np_array = np.array(python_list)
|
|
|
print(np_array)
|
... | ... | |