0
Calculate mean of bool array
How do you calculate the mean of a bool array?! For example [True,False,False,False,True]
3 odpowiedzi
+ 4
Noah ,
please show us a sample array, and what you expect as output.
thanks!
+ 1
you could compute the mean of a bool array, but you'll get a float in range 0, 1 as result (by adding 0 or 1 values abd dividing by array length)... not a boolean (int 0 or 1)...
however, you could get the nearest boolean from the mean by rounding it ;)
+ 1
True is 1, False is 0
So if you summed True + False it would be 1 + 0