[Numpy-discussion] Bool array missing sum function.

Nadav Horesh nadavh at visionsense.com
Wed Aug 18 03:32:05 CDT 2004


Why Bool arrays are missing the sum method?

>>> b = array((1,0,1), type=Bool)
>>> b
array([1, 0, 1], type=Bool)
>>> b.sum()

Traceback (most recent call last):
  File "<pyshell#129>", line 1, in -toplevel-
    b.sum()
  File "/usr/local/lib/python2.4/site-packages/numarray/numarraycore.py", line 1125, in sum
    return ufunc.add.reduce(ufunc.add.areduce(self, type=type).flat, type=type)
  File "/usr/local/lib/python2.4/site-packages/numarray/ufunc.py", line 1165, in _cum_cache_miss
    mode, win1, wout, cfunc, ufargs = \
  File "/usr/local/lib/python2.4/site-packages/numarray/ufunc.py", line 1225, in _cum_setup
    otype, cfunc = ufdict[(optype,)]
KeyError: Bool

   Nadav.




More information about the Numpy-discussion mailing list