import numpy as np
arr = np.array([1, 2, 2, 3, 4, 4, 5])
# 查找数组中的唯一元素
unique_values = np.unique(arr)
print(unique_values) # 输出:[1 2 3 4 5]
# 返回唯一元素及其索引
unique_values, indices = np.unique(arr, return_index=True)
print(unique_values) # 输出:[1 2 3 4 5]
print(indices) # 输出:[0 1 3 4 6]
# 返回唯一元素及其在输入数组中的出现次数
unique_values, counts = np.unique(arr, return_counts=True)
print(unique_values) # 输出:[1 2 3 4 5]
print(counts) # 输出:[1 2 1 2 1]
# 返回唯一元素及其在输入数组中的索引,以便重构输入数组
unique_values, inverse_indices = np.unique(arr, return_inverse=True)
print(unique_values) # 输出:[1 2 3 4 5]
print(inverse_indices) # 输出:[0 1 1 2 3 3 4]
depth_coords储存的是N个xy坐标,现在我想知道这N的坐标点中有无重复的坐标点:
3376<3378,因此存在两种重复的值