Scipy.spatial Valueerror: "x Must Consist Of Vectors Of Length %d But Has Shape %s"
Scipy has an excelent spatial analysis pack which includes a K-dimensional tree. I am attempting to use the query function and it is returning this error: ValueError: x must consi
Solution 1:
Figured it out:
This particular value error is referencing the length of the array used to build the KD Tree.
The %d
value represents the length of the array used to build the KD tree, and the %s
value represents the length of the array like object you are using to query.
In my example the %d
value was 6 because I had built a 6 dimensional array.
The %s
value was 2 because I had only fed it two coordinates: (X,Y)
to query.
My error was that I had accidentally included 4 extra fields when building the KD tree. Now that both values are 2, all works as expected.
Post a Comment for "Scipy.spatial Valueerror: "x Must Consist Of Vectors Of Length %d But Has Shape %s""