I want to improve my Python and I'm curious if there's an elegant way to increment the index of arr in the loop without using integer x in this code:
def predict_one_instance(xSeriesTestVector, xTrainInstances, yTrainCategories, distanceMetric, k):
    distances = calc_distances(xSeriesTestVector, xTrainInstances,distanceMetric)
    sorted_distances = np.sort(distances)
    arr = np.zeros((k,), dtype=int)
    x = 0   
    for el in sorted_distances[:k]:
        arr[x] = yTrainCategories.iloc[np.where(distances == el)]
        x+=1
    return np.bincount(arr).argmax()
 
    