I have data that looks like this
listL= array([array([-12939613.07220617, 3962855.50690994]),
array([-12939614.67349505, 3962828.80807231]),
array([-12939484.00289515, 3962828.1637531 ]),
array([-12939484.98046737, 3962854.91251931]),
print(type(listL)) -> <class 'numpy.ndarray'>
print(type(listL[0])) -> <class 'numpy.ndarray'>
print(type(listL[0][0])) -> <class 'numpy.float64'>
I have a second piece of data that looks like this:
A = array([[ 73.87682896, 8.55827956],
[ 57.43741519, 10.40224912],
[ 87.88970753, 75.42971056],
print(type(A)) -> <class 'numpy.ndarray'>
print(type(A[0])) -> <class 'numpy.ndarray'>
print(type(A[0][0])) -> <class 'numpy.float64'>
The types are the same across both sets of data, but I have a function that works with 'A', but not with 'listL' and I cannot figure out why.
A[spatial.KDTree(A).query(coordinate)[1]]
works, but
listL[spatial.KDTree(listL).query(coordinate)[1]]
returns the error:
not enough values to unpack (expected 2, got 1)
typedoesn't help much. Look atshapeanddtypeinstead.listLIwhich is missing a])) is a 1d object dtype array (shape (4,).Ais a 2d array of numbers, shape (3,2).np.stack(listL)should produce a (4,2) numeric array.