I need to convert a nested for loop with a function call and appending data to a list comprehension.
This is what I would like to convert to a list comprehension
predictions = []
for train_row in test_data:
distances = np.argmin([dist(train_row, test_row) for test_row in train_data])
predictions.append(train_tgt[distances])
predictions = [train_tgt[np.argmin([euclideanDistance(train_row, test_row) for test_row in train_data])] for train_row in test_data]