How do I calculate distance of test data point from centroids in KMeans scikit-learn?
you can try below approach
centroids is a matrix  with all cluster centers
centroids=[[20,40,60,80],[60,120,180,240],[100,200,300,400]]

TestData_vector=[130,170,250,300] #you new test data as a vector

import numpy as np
from sklearn.metrics.pairwise import euclidean_distances
euc_res=euclidean_distances(np.array(centroids), np.array([TestData_vector]))

# normalize the result  
normlaized_res= (1/euc_res)/((1/euc_res).sum())
#convert to list and sort it 
normlaized_res_list=normlaized_res.tolist()
sorted_res=sorted(normlaized_res,reverse=True)
#get the nearset cluster 
nearest_cluster=[]
for i in sorted_res[:10] :
    nearest_cluster.append(normlaized_res_list.index(i))