Browse Source

Numpy

pull/10/head
Jure Šorn 5 years ago
parent
commit
5ab7bfbdfa
1 changed files with 7 additions and 7 deletions
  1. 14
      README.md

14
README.md

@ -1325,9 +1325,7 @@ ValueError: malformed node or string
import ast import ast
from ast import Num, BinOp, UnaryOp from ast import Num, BinOp, UnaryOp
import operator as op import operator as op
```
```python
legal_operators = {ast.Add: op.add, legal_operators = {ast.Add: op.add,
ast.Sub: op.sub, ast.Sub: op.sub,
ast.Mult: op.mul, ast.Mult: op.mul,
@ -1718,15 +1716,17 @@ import numpy as np
<array> = np.random.randint(from_inclusive, to_exclusive, <shape>) <array> = np.random.randint(from_inclusive, to_exclusive, <shape>)
``` ```
#### Shape is a tuple of dimension sizes:
```python ```python
<array>.shape = <shape> # Shape is a tuple of dimension sizes.
<view> = <array>.reshape(<shape>)
<view> = np.broadcast_to(<array>, <shape>)
<array>.shape = <shape>
<view> = <array>.reshape(<shape>)
<view> = np.broadcast_to(<array>, <shape>)
``` ```
#### Axis is an index of dimension that gets collapsed:
```python ```python
<el_or_array> = <array>.sum([<axis>]) # Axis is an index of dimension that gets collapsed.
<el_or_array> = <array>.argmin([<axis>]) # Returns index/es of smallest element/s.
<array> = <array>.sum(<axis>)
<array> = <array>.argmin(<axis>)
``` ```
### Indexing ### Indexing

Loading…
Cancel
Save