Invertiere numpy Boolean Array mit ~ (tilda)
>>> import numpy as np
>>> l1 = np.array([True, False, True])
>>> ~l1
array([False, True, False])
>>> l2 = np.array([[[True], [False], [True]], [[False], [True], [False]], [[True], [True], [True]]])
>>> ~l2
array([[[False],
[ True],
[False]],
[[ True],
[False],
[ True]],
[[False],
[False],
[False]]])
Recommended Posts