Hi Robin,
I had to change the lambda in centroid for me. The global function fn
was not found in lambda. Don't know why fn in centroid is global ?
def centroid(P):
'''compute average point of a set of points'''
fn = float(len(P))
return reduce(lambda x,y,fn=fn: (x[0]+y[0]/fn,x[1]+y[1]/fn),P,(0,0))
Regards,
Dirk