I would like to create a distance matrix from a pair of coordinates. At the moment I'm only using pandas. What I have managed to do so far is the following
data = pd.read_csv('coordinates.txt', sep='\t')
df=[]
L=[]
D=[]
Y=[]
for i in range(data.shape[0]):
distanceMatrix=[]
for k in range(data.shape[0]):
L=float(math.sqrt((data['Easting'][i]-data['Easting'][k])**2+(data['Northing'][i]-data['Northing'][k])**2))
distanceMatrix.append(L)
name='A'+str(i)
df=pd.DataFrame(data=distanceMatrix)
df.rename(columns={0: name}, inplace=True)
D.append(df)
Y=pd.concat(D, axis=1)
This works fine but I was thinking that there should be way of reducing the number of variables.
Thanks