Say I have
>>> arr = np.array([True, True, False], dtype=bool)
Is it possible to call something like
>>> arr.flip_boolean_array_by_index(2)
[True, True, True]
You can use the bitwise-negation operator ~, or bitwise-xor (^) with 1.
arr[idx] = ~arr[idx]
or
arr[idx] ^= 1
idx can be an index, a slice, a "fancy" index, etc.
^= True might be cleaner.numpy.logical_not.at(arr, 2).arr[idx] = not arr[idx] ... no need for binary negation ...