[Numpy-discussion] Upgrade to 1.6.x: frompyfunc() ufunc casting issue

Aditya Sethi ady.sethi at gmail.com
Mon Sep 19 17:38:02 EDT 2011


Hi all,

I am facing an issue upgrading numpy from 1.5.1 to 1.6.1.
In numPy 1.6, the casting behaviour for ufunc has changed and has become
stricter.

Can someone advise how to implement the below simple example which worked in
1.5.1 but fails in 1.6.1?

>>> import numpy as np
>>> def add(a,b):
...    return (a+b)
>>> uadd = np.frompyfunc(add,2,1)
>>> uadd
<ufunc 'add (vectorized)'>
>>> uadd.accumulate([1,2,3])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: could not find a matching type for add (vectorized).accumulate,
requested type has type code 'l'

Thanks,
Aditya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110919/ed30521e/attachment.html>


More information about the NumPy-Discussion mailing list