Professional Documents
Culture Documents
Original Array ( (0 1 2) (3 4 5) (6 7 8) (9 10 11) ) After Swapping Arrays The Last Column and First Column ( (2 1 0) (5 4 3) (8 7 6) (11 10 9) )
Original Array ( (0 1 2) (3 4 5) (6 7 8) (9 10 11) ) After Swapping Arrays The Last Column and First Column ( (2 1 0) (5 4 3) (8 7 6) (11 10 9) )
| Mathematical Function
NumPy contains a large number of various
mathematical operations. NumPy provides
standard trigonometric functions, functions
for arithmetic operations, handling complex
numbers, etc.
1. import numpy as np
output
2.
3. a = np.array([[2,10,20],[80,43,31],[22,43,10]])
Original array:
4.
[[ 2 10 20]
5. print("Original array:\n",a)
[80 43 31]
6.
[22 43 10]]
7. print("\nptp value along axis 1:",np.ptp(a,1))
ptp value along axis 1: [18 49 33]
8.
ptp value along axis 0: [78 33 21]
9. print("ptp value along axis 0:",np.ptp(a,0))
numpy.percentile() function
The syntax to use the function is given below.
1. numpy.percentile(input, q, axis