Append data to numpy string

Question:

for some reason I can’t 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 am not aware of?

Thank you

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

Asked By: Dedder

||

Answers:

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.

Answered By: Mehdi Hamzezadeh
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.