Premium problem143. Winsorize at Given Percentiles

Easy Locked

Given a 1-D float array x and percentile bounds lo and hi, return a copy in which every value below the lo-th percentile is raised to it and every value above the hi-th percentile is lowered to it.

Input

x = [  1.   2.   3.   4. 100.]
lo = 5.0
hi = 95.0

Output

[ 1.2  2.   3.   4.  80.8]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)