changing np.nanmean to np.mean