[Numpy-discussion] bug in ndarray.resize?

Alan G Isaac aisaac@american....
Wed Mar 17 09:08:35 CDT 2010


Is the zero-fill intentional?
If so, it is documented?
(NumPy 1.3)

Alan Isaac

>>> a = np.arange(5)
>>> b = a.copy()
>>> c = np.resize(a, (5,2))
>>> b.resize((5,2))
>>> c  # as expected
array([[0, 1],
        [2, 3],
        [4, 0],
        [1, 2],
        [3, 4]])
>>> b  # surprise!
array([[0, 1],
        [2, 3],
        [4, 0],
        [0, 0],
        [0, 0]])


More information about the NumPy-Discussion mailing list