Ranks With Shared Places
Return the rank of each value, where the smallest value has rank 1. Equal values share the average of the ranks they cover: in [10, 20, 20] the two 20s cover ranks 2 and 3, so each gets 2.5.
Example 1
values [10,20,20]
returns [1.0,2.5,2.5]
10 is rank 1. The two 20s share ranks 2 and 3.
Constraints
1 <= len(values) <= 60
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More SciPy problems
- Solve the SystemEasy
- Value in BetweenEasy
- Are They IndependentMedium
- Break-Even RateMedium
- Cheapest PairingMedium
- Do the Groups DifferMedium
- Fit the DecayMedium
- Is the Mean DifferentMedium