import numpy as np
from scipy.spatial.distance import pdist, wminkowski, squareform
object_1 = [0.2, 4.5, 198, 0.003]
object_2 = [0.3, 2.0, 999, 0.001]
object_3 = [0.1, 9.2, 321, 0.023]
list_of_objects = [object_1, object_2, object_3]
X = np.array(list_of_objects)
distances = pdist(X, wminkowski, 2, [1, 1, 1, 10])
distances_as_2d_matrix = squareform(distances)
print(distances)
print(distances_as_2d_matrix)
Calculate weighted pairwise distance matrix in Python