= np.where((array >= np.mean(array)),1,0) code example
Example: python mean ndarray
# define ndarray a
a = np.array([[1, 2], [3, 4]])
# get the mean
np.mean(a, axis=None)
# define ndarray a
a = np.array([[1, 2], [3, 4]])
# get the mean
np.mean(a, axis=None)