【发布时间】:2021-07-24 08:06:17
【问题描述】:
假设我有三个数组
a = np.array([1,3,5])
b = np.array([2,4,3])
c = np.array([3,2,1])
我想计算每个变量是最大变量的次数。 这是我想要的结果:
a = [False, False, True] #since the last element of a, 5 is the largest among the three arrays
b = [False, True, False] #since the second element of b, 4 is the largest among the three arrays
c = [True, False, false] #since the first element of c, 3 is the largest among the three arrays
这样我就可以使用 sum() 来计算每个变量的最大数量。 谢谢
【问题讨论】:
标签: python arrays numpy numpy-ndarray