[SciPy-User] equivalent of R quantile() function in scipy

Skipper Seabold jsseabold at gmail.com
Tue Dec 4 11:43:08 EST 2012


On Tue, Dec 4, 2012 at 11:44 AM, Jonathan Helmus <jjhelmus at gmail.com> wrote:
> On 12/04/2012 11:26 AM, Pauli Virtanen wrote:
>> 04.12.2012 18:20, Jonathan Helmus kirjoitti:
>>> numpy.percentile can can accept a sequence of percentiles as the second
>>> parameter:
>>>
>>> In [8]: probs = [10.0, 30.0, 50.0, 70.0, 90.0]
>>>
>>> In [9]: a = np.arange(100)
>>>
>>> In [10]: np.percentile(a, probs)
>> [clip]
>>> In [11]: [scipy.stats.scoreatpercentile(a, i) for i in probs]
>>> Out[11]:
>> [clip]
>>
>> It could be useful if someone would take a look if that the
>> implementation in scipy can be easily adapted for that.
>>
> NumPy's implementation is pure python and quite straightforward, I'll
> put together a pull request to include similar functionality in SciPy.
> Adding the limit optional parameter shouldn't be too hard.
>

Great thanks for looking at this. Could you also look at adding an
axis keyword to scoreatpercentile? Should be simple, but IIRC this was
missing the last time I looked at this.

Skipper



More information about the SciPy-User mailing list