numpy delete not deleting element
<p>Under what circumstances would bumpy.delete simply return a copy of the original array, unaltered?</p>

<p>If I do a simple example as follows, then things work as advertised:</p>

<pre><code>&gt;&gt;&gt; a = numpy.arange(0, 10)
&gt;&gt;&gt; numpy.delete(a, [1])
&gt;&gt;&gt; array([0, 2, 3, 4, 5, 6, 7, 8, 9])
</code></pre>

<p>but when I work with an array created from a list by numpy.array() then things don't work anymore.</p>

<pre><code>    scale = [Params.BADVALUE, Params.BADVALUE+1]
    for h in xrange(500, 3001, 500):
        scale.append(h)
    scale += [4000, 5000]
    for h in xrange(7000, 17001, 2000):
        scale.append(h)
    scale.append(upper_bound)
    self.SCALE = numpy.array(scale)
    self.SCALE_WRITE = numpy.delete(self.SCALE, [1000.0])
</code></pre>

<p>self.SCALE_WRITE ends up being identical to self.SCALE</p>

<p>I've checked that self.SCALE is indeed 1-dimensional and that no extra dimensions have been added by mistake.  </p>

<p>It's easy enough to code my way around this but I would still like to know what I'm doing wrong.</p>

<p>Catherine</p>

<p>To me, it appears that you are simply trying to delete an index that is out of the array; hence the lack of change ...
From your code <code>len(scale)</code> gives only 17 .</p>

<p>For the record as the <a href="http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.delete.html" rel="nofollow">doc</a> indicates, <code>numpy.delete(arr,obj)</code> will try to delete the element <strong>returned by arr[obj]</strong> for a 1-D array so :</p>

<ul>
<li>numpy.delete(arr,0)</li>
<li>numpy.delete(arr,[0])</li>
<li>numpy.delete(arr,0.0)</li>
<li>numpy.delete(arr,[0.0])</li>
</ul>

<p>will all <strong>delete <code>arr[0]</code> which is the zero-th element</strong> of that 1-D array.</p>

python arrays numpy