Change the color of lines with categorical column values

38 Views Asked by At

I have the following code:

df1['salary'].groupby(df1['job']).mean().plot(kind='line')

This gives one line as output. I want to have two lines in the output based on another column which is gender.

I tried the following code, but it did not work.

df1['salary'].groupby(df1['job']).mean().plot(kind='line', color=df1['gender'])

I would appreciate if anyone can help me.

0

There are 0 best solutions below