Skip to content

Instantly share code, notes, and snippets.

Created Sep 5, 2020
What would you like to do?
# Define an arbitrary test point
test_pt = [4.8, 2.7, 2.5, 0.7]
# Calculate distance between test_pt and all points in X
distances = []
for i in X.index:
distances.append(minkowski_distance(test_pt, X.iloc[i]))
df_dists = pd.DataFrame(data=distances, index=X.index, columns=['dist'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment