Hướng dẫn dùng np.nanmean python
View Discussion Show Improve Article Save Article View Discussion Improve Article Save Article numpy.nanmean() function can be used to calculate the mean of array ignoring the NaN value. If array have NaN value and we can find
out the mean without effect of NaN value.
Example #1: Python3
Output: Shape of array is (2, 3) Mean of array without using nanmean function: nan Using nanmean function: 26.4 Example #2: Python3
Output: Shape of array is (4, 3) Mean of array with axis = 0: [ 26.5 29.75 nan] Using nanmedian function: [ 26.5 29.75 16.5 ] Example #3: Python3
Output: Shape of array is (4, 3) Mean of array with axis = 1: [ 25.33333333 nan nan 9. ] Using nanmedian function: [ 25.33333333 55. 22.5 9. ] |