python numpy array append not working in .py file, but works in terminal
<p>I am trying to append to a numpy array using np.append.</p>

<p>For example,</p>

<pre><code>a = np.array([1])

np.append(a, [2])
</code></pre>

<p>this code works well in terminal (the result is array([1, 2])), but it won't work when I run a .py file including the same code included in it. When I print a after appending [2], it would still be [1].</p>

<p>Here is the code for my test.py file:</p>

<pre><code>import numpy as np

a = np.array([1])
print(a)
np.append(a, [2])
print(a)
</code></pre>

<p>and this is the result of running it with terminal:</p>

<pre><code>python test.py
[1]
[1]
</code></pre>

<p>Wrong result with no error.
Does anyone know what could possibly be the problem?</p>