best attempt at nearest neighbor

Close, but not quite finished. Got a neighbor from the test data for each item in the training data, but need to then predict a label. Unsure of accuracy of the other work, as a certain value seemed to crop up more often than made sense.
The construct is a bit confusing to read, but correct I think.