[NumPy-Tickets] [NumPy] #1747: numpy.median() and numpy.mean() shoud be more predictable
NumPy Trac
numpy-tickets@scipy....
Fri Feb 18 22:25:04 CST 2011
#1747: numpy.median() and numpy.mean() shoud be more predictable
-------------------------+--------------------------------------------------
Reporter: eriko | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: numpy.core | Version: 1.4.0
Keywords: mean median |
-------------------------+--------------------------------------------------
numpy.mean() and numpy.median() behave differnetly when presented one
dimensional input and a given "axis" argument. While mean() returns a
result, median() raises an IndexError. I think, both ways are fine as long
as both functions behave simmilar.
Example code:
{{{
>>> import numpy
>>> numpy.mean(1, axis=0)
1.0
>>> numpy.median(1, axis=0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6
/site-packages/numpy/lib/function_base.py", line 2805, in median
index = int(sorted.shape[axis]/2)
IndexError: tuple index out of range
>>>
}}}
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1747>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list