I have a function to set colors. Currently, I loop through a dataframe and pass a single value to the function, cross reference that value to its corresponding color value and return the color value. I now want to pass the entire column from the dataframe (instead of looping through the dataframe) and return an array of color values.

Here is a simplified version of the function that currently works passing a single value (I just set the single value instead of showing the entire loop through the dataframe):

```
    def set_LineQualityColor(LineQ):
      data = [['grey', 0], ['cornflowerblue', 1], ['lightgreen', 2],['seagreen', 3], 
            ['mistyrose', 4], ['lightcoral', 4.1],['rosybrown', 5], ['indianred', 5.1], 
            ['lightgray', 9]]
      df = pd.DataFrame(data, columns = ['CR', 'LineQuality'])   
      c=df[df['LineQuality']==LineQ]['CR'].values[0]
    return c

    LQ=4
    c= set_LineQualityColor(LQ)

```

How can I get this to work correctly when `LineQ` is a column from a dataframe? i.e.

```
c= set_LineQualityColor(df.LQ)

```

Or is there a more efficient way to go about doing this? New to python. Thanks.