[Numpy-discussion] Coverting ranks to a Gaussian
Pierre GM
pgmdevlist at gmail.com
Mon Jun 9 22:35:01 EDT 2008
On Monday 09 June 2008 22:30:09 Keith Goodman wrote:
> On Mon, Jun 9, 2008 at 7:02 PM, Pierre GM <pgmdevlist at gmail.com> wrote:
> > There's a scipy.stats.mstats.rankdata() that take care of both ties and
> > missing data. Missing data are allocated a rank of either 0 or the
> > average rank, depending on some parameter.
>
> That sounds interesting. But I can't find it:
> >> import scipy
> >> from scipy import stats
Yes, you should do
>>> import scipy.stats.mstats as mstats
>>> mstats.rankdata
> In my implementation I leave the missing values as missing. I think
> that would be a nice option for rankdata.
Handling missing data is why I needed a tailored rankdata.
In mstats.rankdata, if you set the use_missing optional parameter to False
(the default), they will have a rank of 0. As no other value will have a rank
of zero, you can then remask with masked_values or masked_equal.
More information about the NumPy-Discussion
mailing list