0

I have a boolean array with 1 True. The sum is 1, as expected:

b=np.array(([True,False],[False,False]))
b.sum()

The inverse of b, has 3 True and the sum is 3, as expected:

a=~b
a.sum()

But the sum of ~b is negative 2:

~b.sum()

I'm sure there is a reason. Can someone enlighten me?

Wesley Kitlasten
  • 417
  • 5
  • 15

0 Answers0