Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

alternatives for appending to numpy array


In [2]: a = np.empty((0,3), int)

In [3]: a
Out[3]: array([], shape=(0L, 3L), dtype=int32)

In [4]: a = np.append(a, [[1,2,3]], axis=0)

In [5]: a
Out[5]: array([[1, 2, 3]])

In [6]: a = np.append(a, [[1,2,3]], axis=0)

In [7]: a
Out[7]:
array([[1, 2, 3],
       [1, 2, 3]])

Source by coders911.org #
 
PREVIOUS NEXT
Tagged: #alternatives #appending #numpy #array
ADD COMMENT
Topic
Name
2+4 =