@@ -1457,8 +1457,8 @@ NumPy
1457
1457
** Array manipulation mini language. Can run up to 100 times faster than equivalent Python code.**
1458
1458
``` python
1459
1459
< array> = np.array(< list > )
1460
- < array> = np.ones(< shape> )
1461
1460
< array> = np.arange(from_inclusive, to_exclusive, step)
1461
+ < array> = np.ones(< shape> )
1462
1462
< array> = np.random.randint(from_inclusive, to_exclusive, < shape> )
1463
1463
```
1464
1464
@@ -1482,17 +1482,17 @@ right = [ 0.1 , 0.6 , 0.8 ] # Shape: (3)
1482
1482
1 . If array shapes differ, left-pad the smaller shape with ones.
1483
1483
``` python
1484
1484
left = [[0.1 ], [0.6 ], [0.8 ]] # Shape: (3, 1)
1485
- right = [[0.1 , 0.6 , 0.8 ]]) # Shape: (1, 3) <- !
1485
+ right = [[0.1 , 0.6 , 0.8 ]] # Shape: (1, 3) <- !
1486
1486
```
1487
- 2 . If any dimensions differ in size, expand the ones that have size 1, by duplicating their elements.
1487
+ 2 . If any dimensions differ in size, expand the ones that have size 1 by duplicating their elements.
1488
1488
``` python
1489
1489
left = [[0.1 , 0.1 , 0.1 ], [0.6 , 0.6 , 0.6 ], [0.8 , 0.8 , 0.8 ]] # Shape: (3, 3) <- !
1490
1490
right = [[0.1 , 0.6 , 0.8 ], [0.1 , 0.6 , 0.8 ], [0.1 , 0.6 , 0.8 ]] # Shape: (3, 3) <- !
1491
1491
```
1492
1492
3 . If neither non-matching dimension has size 1, rise an error.
1493
1493
1494
1494
### Example
1495
- ** For each point returns index of its nearest point: ` [0.1, 0.6, 0.8] => [1, 2, 1]) ` .**
1495
+ ** For each point returns index of its nearest point: ` [0.1, 0.6, 0.8] => [1, 2, 1] ` .**
1496
1496
``` python
1497
1497
>> > points = np.array([0.1 , 0.6 , 0.8 ])
1498
1498
array([ 0.1 , 0.6 , 0.8 ])
0 commit comments