Message264670
mean([True, True, True, False]) should be 0.75, but it returns 0.25.
The fix is to change _sum so that when the type is bool, the result should be coerced to int, not bool.
Why it is important for statistics.mean to work with bools:
It is natural to say something like
mean(x > threshold for x in data)
and expect to get the percentage of items in data that are above threshold. |
|
Date |
User |
Action |
Args |
2016-05-02 20:59:11 | Peter.Norvig | set | recipients:
+ Peter.Norvig |
2016-05-02 20:59:11 | Peter.Norvig | set | messageid: <1462222751.06.0.733276334894.issue26913@psf.upfronthosting.co.za> |
2016-05-02 20:59:11 | Peter.Norvig | link | issue26913 messages |
2016-05-02 20:59:10 | Peter.Norvig | create | |
|