Home > Net >  Append data to numpy string
Append data to numpy string

Time:12-14

for some reason i cant append data to a numpy string.

`

for b in range(len(aUnique)):
    temp = aUnique[b]
    print(temp)
    numpy.append(sGewiss, temp)
    #RawData.cell(row=b 1, column=1).value = temp

print(sGewiss)

`

When i print "temp" i can see the right values so the loop is working correctly but when i print the array "sGewiss" i cannot see the new values added but only the old [66830 72312 72812].

Am I using the parameters wrong? Is there a dimension issue I amnot aware of?

Thank you,

Davide

I tried to add around 100 numbers to my array "sGweiss" wich contains only 3 values. I was expecting an array containing the starting 3 elements plus the new 100 elements

CodePudding user response:

you should use :

    sGewiss = numpy.append(sGewiss, temp)

This is because NumPy append function creates a new NumPy array and returns the desired output. It does not change the input array in place.

  • Related