- logical_not
- not
- True
- False
- bool
Numpy: Logical not on a Numpy array
examples/numpy/not_on_np.py
import numpy as np a = np.array([True, True, False]) print(a.dtype) print(a) print() not_a = np.logical_not(a) print(not_a.dtype) print(not_a) print() b = np.array([True, True, False, 0, 42]) print(b.dtype) print(b) print() not_b = np.logical_not(b) print(not_b.dtype) print(not_b) print()
bool [ True True False] bool [False False True] int64 [ 1 1 0 0 42] bool [False False True True False]