I'm trying to create a dictionary that maps a specific array like [1,1,0,0] to a string 'Car' but the dictionary does not accept arrays or lists
a={(1,1,0,0):'Car',
(0,0,0,1):'Pedestrian',
(1,0,0,0):'Traffic Light'}
b=np.array([[1,1,0,0],[1,0,0,0],[0,0,0,1]])
Both codes are free of errors but obviously they don't match. Here is my idea:
b.map(a)
Out[3]=['Car','Traffic Light','Pedestrian']
Thanks in advance.
dictobjects cannot havelistornp.arrayobjects as keys. Perhapstuple(my_list)as a key?mapas defined. Where are you stuck?np.ndarrayobjects don't have a.mapmethod...