numpy array fill na with 1 code example
Example 1: numpy fill na with 0
import numpy as np
A[np.isnan(A)] = 0
Example 2: numpy fill with 0
mat = np.zeros((4,4), np.int32)
import numpy as np
A[np.isnan(A)] = 0
mat = np.zeros((4,4), np.int32)