def func1(arr):
    arr[np.isnan(arr).cumsum(1) > 0] = np.nan

def func2(arr):
    arr[np.maximum.accumulate(np.isnan(arr), axis=1)] = np.nan

def func3(arr):
    mask = np.isnan(arr)
accmask = np.cumsum(mask, out=mask, axis=1)
arr[accmask] = np.nan

def func4(arr):
    mask = np.isnan(arr)
np.maximum.accumulate(mask, axis=1, out=mask)
arr[mask] = np.nan

def func5(arr):
    n = arr.shape[1]
mask = np.isnan(arr)
idx = mask.argmax(1)
idx[~mask.any(1)] = n
arr[idx[:, (None)] <= np.arange(n)] = np.nan
Numpy 2D array: change all values to the right of NaNs