import numpy as np
=[12, 25, 16, 50, 34, 29, 60, 86, 52, 39, 41]
sample_data
= np.percentile(sample_data,75)
percentile
print(percentile)
51.0
The numpy.percentile() function is useful to determine the nth-percentile for the given array of data. It returns an array with percentile values or a scalar along the specified axis. The function accepts the following parameters:
1.array: The array of data whose percentile needs to be calculated.
2.percentile: Denotes the percentile that needs to be computed.
3.axis (optional): Denotes the axis along which the percentile is calculated. By default, a flattened array is used.
4.out (optional): An alternate output array where we can place the result.
5.overwrite_input (optional): Used to modify the input array.
6.keepdims (optional): Creates reduced axes with dimensions of one size.