[SOLVED] Add element to numpy array without changing the name


I want to add a single element : -globals()["q"+str(i)][0][u] to the array mainarray while being inside a loop.

for i in mylist:
    for u in 0,5,10:

After finishing the loop the changes are not save, how can I achieve that?


I had to create a new array with a "+1" dimension of length.

newarray[at_type][at1] = np.zeros((old_length+1))

Then I started the loop.

for i in mylist:
    for u in 0,5,10:

Answered By – TYSH

Answer Checked By – Timothy Miller (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *