Reputation: 135
I am following this link. Everything was fine until I imported this.
import scipy.spatial.ckdtree as spsp
After running this by following the instructions given in the link above. I did this
kdtrees = [spsp(p) for p in coordinates]
I got an error:
TypeError: 'module' object is not callable
SO this is what my cooridinates outout looks like:
coordinates = []
for row in result:
coordinates.append(np.array(row, dtype=float))
print coordinates
Output :[array([ 28.6333, 77.2167]), array([ 28.6333, 77.25 ])]
I don't know where I am going wrong. I followed the instructions as it is as given in the link.
Upvotes: 2
Views: 722
Reputation: 1604
You import import scipy.spatial.ckdtree
as spsp
. That doesn't change the fact that scipy.spatial.ckdtree
is a module and not a callable.
Try importing cKDTree
from import scipy.spatial.ckdtree
, like this:
from scipy.spatial.ckdtree import cKDTree as spsp
...
kdtrees = [spsp(p) for p in coordinates]
Upvotes: 3