replace nan with 0 numpy array code example Example: numpy fill na with 0 import numpy as np A[np.isnan(A)] = 0