<li><strong>Indexes should not be tuples because Python converts <codeclass="python hljs"><spanclass="hljs-string">'obj[i, j]'</span></code> to <codeclass="python hljs"><spanclass="hljs-string">'obj[(i, j)]'</span></code>.</strong></li>
</ul>
<div><h3id="broadcasting">Broadcasting</h3><p><strong>Broadcasting is a set of rules by which NumPy functions operate on arrays of different sizes and/or dimensions.</strong></p><pre><codeclass="python language-python hljs">left = [[<spanclass="hljs-number">0.1</span>], [<spanclass="hljs-number">0.6</span>], [<spanclass="hljs-number">0.8</span>]] <spanclass="hljs-comment"># Shape: (3, 1)</span>
<div><h3id="broadcasting">Broadcasting</h3><p><strong>Set of rules by which NumPy functions operate on arrays of different sizes and/or dimensions.</strong></p><pre><codeclass="python language-python hljs">left = [[<spanclass="hljs-number">0.1</span>], [<spanclass="hljs-number">0.6</span>], [<spanclass="hljs-number">0.8</span>]] <spanclass="hljs-comment"># Shape: (3, 1)</span>
<div><h4id="3ifneithernonmatchingdimensionhassize1raiseanerror">3. If neither non-matching dimension has size 1, raise an error.</h4><div><h3id="example-1">Example</h3><div><h4id="foreachpointreturnsindexofitsnearestpoint010608121">For each point returns index of its nearest point (<codeclass="python hljs">[<spanclass="hljs-number">0.1</span>, <spanclass="hljs-number">0.6</span>, <spanclass="hljs-number">0.8</span>] => [<spanclass="hljs-number">1</span>, <spanclass="hljs-number">2</span>, <spanclass="hljs-number">1</span>]</code>):</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>points = np.array([<spanclass="hljs-number">0.1</span>, <spanclass="hljs-number">0.6</span>, <spanclass="hljs-number">0.8</span>])
<div><h3id="example-1">Example</h3><div><h4id="foreachpointreturnsindexofitsnearestpoint010608121">For each point returns index of its nearest point (<codeclass="python hljs">[<spanclass="hljs-number">0.1</span>, <spanclass="hljs-number">0.6</span>, <spanclass="hljs-number">0.8</span>] => [<spanclass="hljs-number">1</span>, <spanclass="hljs-number">2</span>, <spanclass="hljs-number">1</span>]</code>):</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>points = np.array([<spanclass="hljs-number">0.1</span>, <spanclass="hljs-number">0.6</span>, <spanclass="hljs-number">0.8</span>])