python - Appending list elements to a symarray -


i'm trying add numpy arrays single array, code looks like:

m1=symarray('', 2) in range(0,len(countersum)):   if countersum[i]==1:     m1.append(gmcounter[i]) 

this give error

attributeerror: 'numpy.ndarray' object has no attribute 'append' 

i have tried changing append vstack gives same error

if modify last line have m1=gcounter[i] works selects first element of gcounter meeting condition, , disregards afterwards.

does know how can resolve this?

i have seen thread append numpy array numpy array unable declare need append numpy array beforehand.

many thanks

@bakuriu correct, can not extend numpy array without copying. however, depending on application, can convert numpy array list , manipulate there:

m1 = sympy.symarray('', 2)  m2 = list(m1) x = sympy.symbols('x') m2.append(x)  print m2 

this gives

>>> [_0, _1, x] 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -