Numpy zamień
import numpy as np
array1 = np.array([2, 2, 2, 0, 2, 0, 2])
print(np.where(array1==0, 1, array1))
# OUTPUT = [2 2 2 1 2 1 2]
Excited Eel
import numpy as np
array1 = np.array([2, 2, 2, 0, 2, 0, 2])
print(np.where(array1==0, 1, array1))
# OUTPUT = [2 2 2 1 2 1 2]