473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

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)

Nure
Feb 28 '08 #1
2 9676
nu*****@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)
Presumably, you are using exp() from the builtin module math, which knows
nothing about Numeric. Use Numeric.exp() instead.

I do recommend upgrading to numpy and asking further questions on the numpy
mailing list.

http://www.scipy.org/Mailing_Lists

When reporting an error, please include the smallest *complete* snippet of code
that demonstrates the problem, as well as the complete traceback.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Feb 28 '08 #2
nu*****@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.

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

Feb 28 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Thorsten Kampe | last post by:
What is the best way to except two errors, when the except handling in both cases is the same? "except:" would just except every error and not just those I want. except Attribute error:...
2
by: Balaji | last post by:
Hello Everybody... I have a problem.. This is the code... -------------------------------------- class Stack: def __init__(self,expr): self.stackP=
7
by: ‘5ÛHH575-UAZWKVVP-7H2H48V3 | last post by:
(see end of message for example code) When an instance has a dynamically assigned instance method, deepcopy throws a TypeError with the message "TypeError: instancemethod expected at least 2...
3
by: Manish Gupta (BBS) | last post by:
Hello invoking something like following - sock.send(100) generates the following error - TypeError: send() argument 1 must be string or read-only buffer, not int
42
by: Holger | last post by:
Hi guys Tried searching for a solution to this, but the error message is so generic, that I could not get any meaningfull results. Anyways - errormessage:...
8
by: digitalorganics | last post by:
What are the reason one would get this error: TypeError: Cannot create a consistent method resolution order (MRO) for bases object ?? I can provide the code if needed....
1
by: OtisUsenet | last post by:
Hi, I have a bookmarklet that works perfectly in Firefox, IE, Konqueror, and Opera, but in Safari 2.0.3 (417.9.2) it doesn't work. I enabled debugging and I can see "TypeError - Undefined...
8
by: Gilbert Fine | last post by:
This is a very strange exception raised from somewhere in our program. I have no idea how this happen. And don't know how to reproduce. It just occurs from time to time. Can anyone give me some...
33
by: christophertidy | last post by:
Hi I am new to Python and have recieved this error message when trying to instantiate an object from a class from another file within the same directory and wondered what I have done wrong. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.