Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

numpy replace

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]
Source by www.kite.com #
 
PREVIOUS NEXT
Tagged: #numpy #replace
ADD COMMENT
Topic
Name
2+7 =