[Numpy-discussion] np.bincount raises MemoryError when given an empty array

Ernest Adrogué eadrogue@gmx....
Mon Feb 1 11:02:59 CST 2010


Consider the following code:

for j in range(5):
	f = np.bincount(x[y == j])

It fails with MemoryError whenever y == j is all False element-wise.

In [96]: np.bincount([])
MemoryError                               Traceback (most recent call last)

/home/ernest/<ipython console> in <module>()


In [97]: np.__version__
Out[97]: '1.3.0'

Is this a bug?


More information about the NumPy-Discussion mailing list