def find_rows(location_arr):
iterable = zip(location_arr[:,0], location_arr[:,1])
result_list = []
for thing in combinations(iterable, 2):
print(thing[0][1], thing[1][1])
if float(thing[0][1]) == float(thing[1][1]):
result_list.append(thing)
return result_list
# a = location_arr
# b = np.copy(location_arr)
# dt = np.dtype((np.void, a.dtype.itemsize * a.shape[1]))
#
# a_view = np.ascontiguousarray(a).view(dt).ravel()
# b_view = np.ascontiguousarray(b).view(dt).ravel()
#
# sort_b = np.argsort(b_view)
# where_in_b = np.searchsorted(b_view, a_view,
# sorter=sort_b)
# where_in_b = np.take(sort_b, where_in_b)
# which_in_a = np.take(b_view, where_in_b) == a_view
# where_in_b = where_in_b[which_in_a]
# which_in_a = np.nonzero(which_in_a)[0]
# return np.column_stack((which_in_a, where_in_b))
评论列表
文章目录