I have an array of integers representing class label:
y = np.array([0,1,0,2,3,4,1,3,2,4])
I want replace elements 0, 1 with class name "stopped" and elements 2,3,4 with class name "moving".
class_mapping = {"stopped": [0, 1], "moving": [2,3,4]}
label = y.map(class_mapping)
AttributeError: 'numpy.ndarray' object has no attribute 'map'
Required output:
label = ["stopped", "stopped", "stopped", "moving", "moving", "moving", "stopped", "moving", "moving", "moving"]