How to replace values in a numpy array?
import numpy as np

a = np.array(['PAIDOFF', 'COLLECTION', 'COLLECTION', 'PAIDOFF'])

f = lambda x: 1 if x == &quot;COLLECTION&quot; else 0

np.fromiter(map(f,a),dtype=np.int)

Alternative:
np.where(a == &quot;COLLECTION&quot;,1,0)