任何人都可以解釋這一點嗎? (Python 3.3.2,numpy 1.7.1):NumPy調整大小的方法
>>> a = np.array([[1,2],[3,4]])
>>> a # just a peek
array([[1, 2],
[3, 4]])
>>> a.resize(3,2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: cannot resize an array references or is referenced
by another array in this way. Use the resize function
>>> a = np.array([[1,2],[3,4]])
>>> a.resize(3,2)
>>> a
array([[1, 2],
[3, 4],
[0, 0]])
>>> a = np.array([[1,2],[3,4]])
>>> print(a) # look properly this time
[[1 2]
[3 4]]
>>> a.resize(3,2)
>>> a
array([[1, 2],
[3, 4],
[0, 0]])
爲什麼要在數組中創建一個引用呢? (或者至少,爲什麼在完成查找之後該引用仍然存在?) 另外,它只是我還是那個異常需要一點重寫?
這不僅僅是你。異常信息缺少「參考」前面的「哪個」,並且可以使用健康的標點符號和大寫字母。 –