[Numpy-discussion] your numpy bug-report -- clamp and percentile

Sebastian Haase haase@msg.ucsf....
Tue Mar 25 04:47:19 CDT 2008

Hi  Connelly !

I saw your bug-report (#626) was closed (as invalid).
[[ I think "invalid" is wrong, since numpy != scipy ]]

<copy of bug report>
 Two functions I am continually re-implementing in my own number-crunching
 projects are percentile() and clamp().  Here percentile(array, p) returns
 the pth percentile of array, using linear interpolation (p=0.5 is median,
 p=1.0 is max, p=0.25 is lower quartile, etc).  And clamp(array, lo, hi)
 clamps to lower and upper bound scalars.

 Would these functions be appropriate for numpy?  Will you accept patches?

 Connelly Barnes
 connellybarnes at-symbol gmail dot com
</copy of bug report>

If someone wants to not  "rely" on scipy , then the precentile would
still be missing .....
(And I also have a C implementation for *inplace* clamp (clip)  )

Would you mind sending me the code you use for those functions ?

Sebastian Haase

More information about the Numpy-discussion mailing list