Based on the list comprehension solution of Python dictionary: Get list of values for list of keys question, I'm trying to do the same for my dict "values-extraction" but I get either 'Series' objects are mutable, thus they cannot be hashed error or unhashable type: 'list' :( please help.
I have a dict :
region_colors = {
 'Speyside': '#0173b2',
 'Highlands': '#de8f05',
 'Lowlands': '#029e73',
 'Islands': '#d55e00',
 'Campbelltown': '#cc78bc',
 'Islay': '#ca9161'}
and a list:
region_colsbis = [[
  'Highlands',
  'Speyside',
  'Speyside',
  'Speyside',
  'Speyside',
  'Lowlands',
  'Speyside',
  'Speyside',
  'Islay',
  'Highlands',
  ...,
  'Highlands']]
which actually comes from an extraction of a dataframe column.
I need to convert this past list into the value elements of the dict region_colors, so that every time the region_colsbis list says 'Highlands' a new list (say region_cols) reflects '#de8f05'
expected output:
region_cols = ['#de8f05', '#0173b2', '#0173b2', '#0173b2', '#0173b2', '#029e73', ...]
I've tried doing
[region_colors[x] for x in region_colsbis]
and
for element in region_colsbis:
    region_cols.append(region_colors[element].value)
but I keep getting the errors mentioned before. Could you demigods of Python please help this humble peasant?
 
    