Numpy recarray functions throw TypeError: cannot perform reduce with flexible type

78 Views Asked by At

I would like to work with numpy.recarrays as described here: numpy.recarray

I construct the numpy.recarray like described and want to execute simple .max(),.sum() methods:

a = np.recarray((2,), dtype=[('x', int), ('y', float), ('z', int)])
a.sum(axis=0)

However, I get:

TypeError: cannot perform reduce with flexible type

What am I missing?

1

There are 1 best solutions below

0
Rory Yorke On

From the final paragraph of Structure Comparison

[...] arithmetic and bitwise operations are not supported.

I suggest looking at Pandas for this sort of thing.