Numpy: change max in each row to 1, all other numbers to 0

后端 未结 3 1717
隐瞒了意图╮
隐瞒了意图╮ 2020-12-15 03:32

I\'m trying to implement a numpy function that replaces the max in each row of a 2D array with 1, and all other numbers with zero:

>>> a = np.array(         


        
3条回答
提交回复
热议问题