[Numpy-discussion] in the NA discussion, what can we agree on?
strang at nmr.mgh.harvard.edu
Fri Nov 4 21:24:25 EDT 2011
>> Also, how does something like this get handled?
>>>>> a = [1, 2, IGNORED(3), NaN]
>> If I were to say, "What is the mean of 'a'?", then I think most of the time
>> people would want 1.5.
> I would want NaN! But that's because the only way I get NaN's is when
> I do dumb things like compute log(0), and again, I want my code to
> tell me that I was dumb instead of just quietly making up a
> meaningless answer.
As another data point, I prefer control over this sort of situation.
Sometimes I'm completely in agreement with Nathaniel and want the
operation to fail. Other times I am forced to perform operations (e.g.
log) on a huge matrix, and I fully expect some 0s may be in there. For a
complex enough chain of operations, looking for all the bad apples at each
step in the chain can be prohibitive, so in those cases I'm looking for
"compute it if you can, and give me a NaN if you can't" ...
The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.
More information about the NumPy-Discussion