Finding average of NumPy arrays is quite similar to finding average of given numbers. We just have to get the sum of corresponding array elements and then divide that sum with the total number of arrays.
Let’s see an example:
Example 1: Calculate average values of two given NumPy 1d-arrays
Average of NumPy arrays: [2. 2.]
Example 2: Calculate average values of two given NumPy 2d-arrays
Average of NumPy arrays: [[2. 2.] [7. 4.]]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.