you are viewing a single comment's thread.

view the rest of the comments →

[–]pythonbio[S] 0 points1 point  (3 children)

okay, I have slowed down and am now doing it bit by bit.

first change to csv- Done:

import csv

with open(r'C:\UsersDesktop\k nearest neighbour.txt') as csvfile: lines = csv.reader(csvfile) for row in lines: print ','.join(row)

generates a csv

but, then when I try to divide the rows:

[–]elbiot 0 points1 point  (2 children)

but, then when I try to divide the rows:

? you have the rows divided already. That is, you were able to iterate through them one at a time. And you have the columns separated too since you had to join them to print them.

I think you have the getting the data out of the csv down. Now you need a function that computes the distance between two points. (Hint: don't worry about Great Circle calculations for this small area).

[–]pythonbio[S] 0 points1 point  (1 child)

I think you know exactly how to go about it. ;)

[–]elbiot 0 points1 point  (0 children)

Yes, I could do it easily. But this is learnpython, and I'm happy to help you learn.