Q:

Write a NumPy program to compute the 80th percentile for all elements in a given array along the second axis

0

Write a NumPy program to compute the 80th percentile for all elements in a given array along the second axis.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
x = np.arange(12).reshape((2, 6))
print("\nOriginal array:")
print(x)
r1 = np.percentile(x, 80, 1)
print("\n80th percentile for all elements of the said array along the second axis:")
print(r1)

Sample Output:

Original array:
[[ 0  1  2  3  4  5]
 [ 6  7  8  9 10 11]]

80th percentile for all elements of the said array along the second axis:
[ 4. 10.]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now