Is there a library for Python 2.7 that can solve quartiles and deciles. It seems that numpy doesn't have any functions for it. Can you give me a link if there are any. Thanks in advance! :D
Using np.percentile, you could try something like
>>> import numpy as np
>>> var = np.array([10, 7, 4, 3, 2, 1]) # input array
>>> np.percentile(var, np.arange(25, 100, 25)) # quartiles
array([2.25, 3.5 , 6.25])
>>> np.percentile(var, np.arange(10, 100, 10)) # deciles
array([1.5, 2. , 2.5, 3. , 3.5, 4. , 5.5, 7. , 8.5])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With