[英]Python numpy boolean array not whole columns and rows
I want to apply the NOT operation on whole columns/rows of a boolean Numpy array .我想对boolean Numpy 数组的整列/行应用NOT操作。 Is this possible with Numpy?
Numpy 可以吗?
matrix = np.array([[False for i in range(3)] for j in range(2)])
# Initial
# [False, False, False]
# [False, False, False]
matrix[:,1].not() # Something like this
# After not operation on column 1
# [False, True, False]
# [False, True, False]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.