human
2. def sortdist(df, vec): calculate Eulidean distance between input 1-D array and each row in input dataframe.

input: (df: a dataframe.
vec: 1-D array with 2 elements)
output: distance is ordered from min to max with its index.
 Give me a Python code to calculate Eulidean distance between input 1-D array and each row in input dataframe?
assistant
#Here is Python code to calculate Eulidean distance between input 1-D array and each row in input dataframe.
"""
def sortdist(df, vec):
#Use for loop, calculate Eulidean distance between input 1-D array and
#each row in input dataframe.
    distlist = []
    for index, row in df.iterrows():
        distlist.append([dist(row[0:2],vec),index])
#Output is ordered from min to max with its index.
    distlist.sort()
    return(distlist)
"""
print()

#Try
knn.sortdist(data,[0.5,0.5])