
Hi, On Mon, Sep 19, 2011 at 2:38 PM, Aditya Sethi <ady.sethi@gmail.com> wrote:
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'
Seems to work ok on the latest version: In [12]: uadd([1,2,3],[1,2,3]) Out[12]: array([2, 4, 6], dtype=object) In [13]: np.__version__ Out[13]: '2.0.0.dev-af22fc4' Cheers Stéfan