嗨,我有一个像这样的二维数组
[[0 2] [0 1] [1 2] [1 2] [0 1] [1 2] [0 1] [0 1] [1 3] [2 3]]
我需要计算每个数组的出现次数,例如 [0, 1] = 4、[0,2] = 1 等。最好使用 numpy。 然后提取最大值。 预先感谢。
np.unique() 会为你做的
unique_arr, num = np.unique(arr, axis=0, return_counts=True)