I've been trying to craft a Manhattan distance function in Python.
However, it seems quite straight forward but I am having trouble.
Can anyone help me out with Manhattan distance metric written in Python?
Thanks in advance,
Jump to content
#This operation returns the Manhattan distance. # def getManhattan(xList,yList): return float(xList-xList) + abs(yList-yList)As a note here, you may need to swap the 1 and 0 around, depending on how you are storing points. I would expect xList-xList + yList-yList to be closer to what you need, but I'm not sure how exactly you are storing points, so I can't be 100% certain.
0 members, 0 guests, 0 anonymous users
Community Forum Software by IP.Board
Licensed to: Geeks to Go, Inc.