-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Closed
Description
>>> np.__version__
'1.13.3'
A rounding error occurs for certain value/percentile combinations.
>>> a = np.ones(279) * 0.56758051638767337
>>> np.unique(a)
array([ 0.56758052])
The array containing only identical values all percentiles should be equal to that value but that is not the case for the 45th percentile:
>>> for p in range(0,100,5):
if np.percentile(a, p) != a[0]:
print(p)
45
And indeed:
>>> np.percentile(a, 45)
0.56758051638767348
>>> np.percentile(a, 45) - a[0]
1.1102230246251565e-16
The problematic percentile(s) depend on the length and the value of the array:
>>> b = np.ones(279) * 60287681548494698
>>> np.unique(b)
array([ 60287682])
>>> for p in range(0,100,5):
if np.percentile(b, p) != b[0]:
print(p)
95
>>> np.percentile(b, 95)
0.60287681548494709
Metadata
Metadata
Assignees
Labels
No labels