First let me show what i want to do.
I have a matrix,
x = [1, 2, 1, 2, 3, 3, 2, 3, 1, 2]
All i want do is to select position of repeated numbers in the array and print it in a matrix x_new where :
x_new[0]= [0,2,8] (for similar position of repeated 1's in x)
x_new[1]=[1,3,6,9](for similar position of repeated 2's in x)
x_new[2]=[4,5,7] (for similar position of repeated 3's in x)
Until now what i have done is :
a=[]
x=m[:,3] #x=np.array([1, 2, 1, 2, 3, 3, 2, 3, 1, 2])
ss=set([i for i in x if sum([1 for a in x if a == i]) > 1])
lenss=len(ss)
for ln in range(lenss):
for k in range(10):
if(x[k]== list(ss)[ln]):
print k
a.append(ln)
print 'next'
But at the a.append line it's showing:
'numpy.int32' object has no attribute 'append'
Can anyone please tell me how to overcome this error? Thanks