Why code is giving error in function calling

import numpy as np
import pandas as pd

dfx = pd.read_csv(‘Diabetes_XTrain.csv’)
dfy = pd.read_csv(‘Diabetes_YTrain.csv’)
dfz = pd.read_csv(‘Diabetes_Xtest.csv’)

X = dfx.values
Y = dfy.values

print(X.shape)
print(Y.shape)

def dist(x1,x2):
return np.sqrt(sum=((x1-x2)**2))

def knn(X,Y,querypoint,K=575):
vals=[]
m=X.shape[0]

for i in range(m):
    d=dist(querypoint,X[i])
    vals.append(d,Y[i])
vals=sorted(vals)

vals = vals[:K]
vals = np.array(vals)
print(vals)

new_vals=np.unique(vals[:,1],return_counts=True)
print(new_vals)
return vals

index=new_vals[1].argmax()
pred=new_vals[0][index]
return pred

Z = dfz.values
print(Z.shape)
k = Z.shape[0]
print(k)
k=int(k)
ans=[]
for i in range(k):
a=knn(X,Y,Z[i])
ans.append(a)

Hey @sunaina143, please upload the ipynb notebook on google drive, make it sharable and then share the link here.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.