Let’s see how to calculate deciles in Python.
Calculating deciles in Python
To calculate deciles, we need to import the statistics module.
You can use the quantiles function from the statistics module, specifying n=10, to calculate deciles.
import statistics as s x = [1, 5, 7, 5, 43, 43, 8, 43, 6, 65, 63, 42, 1, 76, 43, 87, 53, 54] deciles = s.quantiles(x, n=10) print("Deciles are: " + str(deciles))