1. Write a Python Numpy program to generate 3x3 matrix and display the maximum and minimum of y axis .
The output is:
Expected Answer:
3x3 matrix:
[[0 1 2]
[3 4 5]
[6 7 8]]
Maximum value along the y axis: [2 5 8]
Minimum value along the y axis: [0 3 6]
2. Write a Python Numpy program to generate 3x3 array and display the maximum and minimum of value in the 3x3 array.
The output is:
Expected Answer:
3x3 array:
[[0 1 2]
[3 4 5]
[6 7 8]]
Maximum value of the array:
8
Minimum value of the array:
0
3. Write a Python Numpy program to generate 3x3 array and calculate to find out the difference between maximum and minimum value in x axis.
The output is:
Expected Answer:
3x3 array:
[[0 1 2]
[3 4 5]
[6 7 8]]
Difference between the maximum and the minimum values of the 3x3 array:
[2 2 2]
4. Write a Python Numpy program to generate 4x3 array and find out the median of the array.
The output is:
Expected Answer:
Initial 3x4 array:
[[ 0 1 2 3]
[ 4 5 6 7]
[ 8 9 10 11]]
Median of 3x4 array: 5.5
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]
6. Write a Python Numpy program to calculate weight average of the given array in the following output.
The output is:
Expected Answer:
Initial array: [1 2 3 4 5]
Weights: [2 3 4 5 6]
Weighted average of the array: 3.5
7. Write a Python Numpy program to calculate the mean, standard deviation and variance of the given array in the following output.
The output is:
Expected Answer:
Initial array: [1 2 3 4 5]
Mean: 3.0
Standard deviation: 1.707825127659933
Variance: 2.9166666666666665
8. Write a Python Numpy program to calculate cross-correlation of the two given array in the following output.
The output is:
Expected Answer:
Initial array1:
[1 2 3 4]
Initial array2:
[6 7 8 9]
Cross-correlation of the arrays:
[[1.66666667 1.66666667]
[1.66666667 1.66666667]]
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)