Q:

How to turn the coordinate found from distance matrix to be positive?

import numpy as np
import matplotlib.pyplot as plt
import time
from sklearn.decomposition import PCA

t = np.random.randint(0, 50, (10, 10)) 
X = tpca = PCA(n_components=2) 
X3d = pca.fit_transform(X) 
X3d= np.round(X3d, 2) 
print (X3d)

How to turn the coordinate found from distance matrix to be positive?

A:

You can use absolute, import math library and use abs().
example:
import math

distance = -40
print(abs(distance))

Output:
40

