Browse Source

NumPy indexing

pull/152/head
Jure Šorn 1 year ago
parent
commit
fc1186c28e
2 changed files with 2 additions and 0 deletions
  1. 1
      README.md
  2. 1
      index.html

1
README.md

@ -2680,6 +2680,7 @@ import numpy as np
<1d/2d_a> = <2d_array>[<2d/1d_bools>] # 1d_bools must have size of a column.
```
* **Indexes should not be tuples because Python converts `'obj[i, j]'` to `'obj[(i, j)]'`.**
* **Any value that is broadcastable to the indexed shape can be assigned to the selection.**
### Broadcasting
**Set of rules by which NumPy functions operate on arrays of different sizes and/or dimensions.**

1
index.html

@ -2194,6 +2194,7 @@ drawer = cg.output.GraphvizOutput(output_file=filename)
</code></pre>
<ul>
<li><strong>Indexes should not be tuples because Python converts <code class="python hljs"><span class="hljs-string">'obj[i, j]'</span></code> to <code class="python hljs"><span class="hljs-string">'obj[(i, j)]'</span></code>.</strong></li>
<li><strong>Any value that is broadcastable to the indexed shape can be assigned to the selection.</strong></li>
</ul>
<div><h3 id="broadcasting">Broadcasting</h3><p><strong>Set of rules by which NumPy functions operate on arrays of different sizes and/or dimensions.</strong></p><pre><code class="python language-python hljs">left = [[<span class="hljs-number">0.1</span>], [<span class="hljs-number">0.6</span>], [<span class="hljs-number">0.8</span>]] <span class="hljs-comment"># Shape: (3, 1)</span>
right = [ <span class="hljs-number">0.1</span> , <span class="hljs-number">0.6</span> , <span class="hljs-number">0.8</span> ] <span class="hljs-comment"># Shape: (3,)</span>

Loading…
Cancel
Save