# sort the array by the last column
orders = np.argsort(arr[:,-1])
# rearrange the array increasingly by last column
arr = arr[orders]
# use `unique` to find the unique pairs
# `return_index` option returns the indexes of the first occurrence for each pair
# since last column is increasing, first instance means minimum value
uniques, indexes = np.unique(arr[:,:-1], axis=0, return_index=True)
# extract the first instances together with the last column
out = arr[indexes]
1条答案
按热度按时间m0rkklqb1#
尝试:
示例数据:
输出: