[Numpy-discussion] Output dtype
bsouthey at gmail.com
Mon Dec 13 21:50:01 EST 2010
On Mon, Dec 13, 2010 at 4:53 PM, Keith Goodman <kwgoodman at gmail.com> wrote:
> On Mon, Dec 13, 2010 at 12:20 PM, Bruce Southey <bsouthey at gmail.com> wrote:
>> Unless something has changed since the docstring was written, this is
>> probably an inherited 'bug' from np.mean() as the author expected that
>> the docstring of mean was correct. For my 'old' 2.0 dev version:
>> >>> np.mean( np.array([[0,1,2,3,4,5]], dtype='float32'), axis=1).dtype
>> >>> np.mean( np.array([[0,1,2,3,4,5]], dtype='float32')).dtype
> Are you saying the bug is in the doc string, the output, or both? I
> think it is both; I expect the second result above to be float32.
This was a surprise to me as this 'misunderstanding' goes back to at
least numpy 1.1.
The documentation is wrong when using axis argument.
There is a bug because the output should be the same dtype for all
possible axis values - which should be a ticket regardless. The recent
half-float dtype or if users want the lower precision suggests that it
might be a good time to ensure the 'correct' option is used (whatever
More information about the NumPy-Discussion