how to keep a lot of arrays in one variable python numpy -
i have lot of arrays, every 2d, has other sizes. looking idea how keep them in 1 variable. order of them important. recommend? arrays? dictionaries? ideas?
my problem: have numpy array:
b=np.array([]) and want add them e.g. array:
a=np.array([0,1,2]) and later:
c=np.array([[0,1,2],[3,4,5]]) etc
result should be:
b=([0,1,2], [[0,1,2],[3,4,5]]) i don't know how in numpy , without initializing size of first array.
if ordering important, store them in list (mylist = [array1, array2, ...]) - or, if you're not going need change or shuffle them around after creating list, store them in tuple (mylist = (array1, array2, ...)).
both of these structures can store arbitrary object types (they don't care arrays different sizes, or same kind of object @ all) , both maintain consistent ordering can accessed through mylist[0], mylist[1] etc. appear in correct order when go through them using for an_array in mylist: etc.
Comments
Post a Comment