I am trying to create a dictionary of colors where an integer maps to a color. In my first list l1, it has 177 items but only 5 unique integers (0 to 4). In the second list, it has 5 html colors. I am trying to create a dictionary where each color will map to a unique integer.
l1=[3 2 3 3 0 2 4 4 2 3 2 2 4 0 3 2 2 2 1 3 2 3 2 2 2 0 3 1 0 2 2 2 4 2 4 2 0
2 0 4 0 4 2 0 2 2 2 4 1 3 2 2 2 1 0 3 3 2 0 2 3 4 1 0 0 1 3 1 3 1 4 3 4 1
4 0 2 3 2 0 4 1 3 0 0 4 0 4 0 2 2 1 2 2 1 0 4 4 3 1 3 2 2 2 4 4 2 0 3 4 4
0 3 4 3 4 2 2 2 3 3 1 0 2 3 1 1 4 0 1 2 0 0 2 0 0 0 0 2 3 1 0 3 3 3 2 2 3
3 0 0 0 2 0 3 2 0 0 0 2 2 0 4 3 3 0 2 2 3 2 3 3 0 2 0 4 3]
l2=['#000000', '#FFFFFF', '#FF0000', '#00FF00', '#0000FF']
Here is my code:
color_map=dict(zip(l1,l2))
print color_map
However, I get an incocomplete dictionary:
{0: '#0000FF', 2: '#FFFFFF', 3: '#00FF00'}
How do i fix this?