5. Write a Python Numpy program to calculate the 65th percentile for all elements in the 3x4 array along the first axis (x-axis).
The output is:
Expected Answer:
Initial 3x4 array:
[[ 0 1 2 3]
[ 4 5 6 7]
[ 8 9 10 11]]
65th percentile for all elements of the 3x4 array along the first axis:
[5.2 6.2 7.2 8.2]
Sample Answer:
import numpy as np a = np.arange(12).reshape((3, 4)) print("Initial 3x4 array:") print(a) r1 = np.percentile(a, 65, 0) print("\n65th percentile for all elements of the 3x4 array along the first axis:") print(r1)
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)