[Numpy-discussion] Median again

Matthew Brett matthew.brett@gmail....
Tue Jan 29 15:31:30 CST 2008

> >> median moved mediandim0
> >> implementation of medianwithaxis or similar, with same call
> >> signature as mean.
> >>
> >> Deprecation warning for use of median, and return of mediandim0 for
> >> now.  Eventual move of median to return medianwithaxis.
> >
> > This would confuse people even more, I'm afraid. First they're said
> > that median() is deprecated, and then later on it becomes the standard
> > function to use. I would actually prefer a short pain rather than a
> > long one.

I was thinking the warning could be something like:

"The current and previous version of numpy use a version of median
that is not consistent with other summary functions such as mean.  The
calling convention of median will change in a future version of numpy
to match that of the other summary functions.  This compatible future
version is implemented as medianwithaxis, and will become the default
implementation of median.  Please change any code using median to call
medianwithaxis specifically, to maintain compatibility with future
numpy APIs."

> I would certainly like median to take the axis keyword. The axis
> keyword (and its friends) could be added to 1.0.5 with the default
> being 1 instead of None, so that it keeps compatibility with the 1.0
> API. Then, with 1.1 (an API-breaking release) the default can be
> changed to None to restore consistency with mean, etc.

But that would be very surprising to a new user, and might lead to
some hard to track down silent bugs at a later date.


More information about the Numpy-discussion mailing list