Hello im currently trying to convert this array
test=np.array([[0,0],[0,1],[1,1],[3,0]])
and using Manhattan distance to convert this array into this shape
[0., 1., 2., 3.]
[1., 0., 1., 4.]
[2., 1., 0., 3.,
[3., 4., 3., 0.]
the code goes like this
list_x=[]
newarray=np.array([])
length=len(test)
for i in range(length):
for j in range(length):
print('i=',i)
print('j=',j)
var=sum(abs(a-b) for a,b in zip(test[i],test[j]))
list_x.append(var)
newarray= np.append(newarray,list_x,axis = 0)
list_x=[]
but the outcome of the code keeps giving me this:
array([0., 1., 2., 3., 1., 0., 1., 4., 2., 1., 0., 3., 3., 4., 3., 0.])
is there a problem in my np.append() that prevent to convert it to 4*4 shap array ?
