Skip to content

Commit 179c627

Browse files
committed
Numpy
1 parent db2990b commit 179c627

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,7 @@ NumPy
16931693
import numpy as np
16941694
```
16951695

1696+
**Shape is a tuple of ints, representing sizes of array's dimensions.**
16961697
```python
16971698
<array> = np.array(<list>)
16981699
<array> = np.arange(from_inclusive, to_exclusive, step_size)
@@ -1713,26 +1714,26 @@ import numpy as np
17131714

17141715
### Indexing
17151716
#### Basic indexing
1716-
```python
1717+
```bash
17171718
<el> = <2d_array>[0, 0]
17181719
```
17191720

17201721
#### Basic slicing
1721-
```python
1722+
```bash
17221723
<1d_view> = <2d_array>[0] # First row.
17231724
<1d_view> = <2d_array>[:, 0] # First column. Also [..., 0].
17241725
<3d_view> = <2d_array>[None,:,:] # Expanded by dimension of size 1.
17251726
```
17261727

17271728
#### Integer array indexing
17281729
**If row and column indexes differ in shape, they are combined with broadcasting.**
1729-
```python
1730+
```bash
17301731
<1d_array> = <2d_array>[<1d_row_indexes>, <1d_column_indexes>]
17311732
<2d_array> = <2d_array>[<2d_row_indexes>, <2d_column_indexes>]
17321733
```
17331734

17341735
#### Boolean array indexing
1735-
```python
1736+
```bash
17361737
<2d_bool_array> = <2d_array> > 0
17371738
<1d_array> = <2d_array>[<2d_bool_array>]
17381739
```

0 commit comments

Comments
 (0)