TypeError: only length-1 arrays can be converted to Python scalars.

Steve Holden steve at holdenweb.com
Thu Feb 28 21:05:07 CET 2008

nure123 at gmail.com wrote:
> Hi All,
> Could anybody tell me what is the problem with the following sequence
> with which I always get the above error message. I use Numeric and
> Python 2.4
> x=array([1,2,3,4])
> y=exp(x)

The meaning of the error message is fairly obvious - exp() can't operate 
on arrays. I presume Numeric has its own exp(), and that you need to use 
that instead.

Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/

More information about the Python-list mailing list