Skip to content
Advertisement

comparing two pandas columns particular content and changing the color as per condition

I have a data frame as shown below.

JavaScript

In the first row I need to compare SPEC_TYP with max. In the 2nd row I need to compare SPEC_MAX with max.In the 3rd row SPEC_TYP with max and in some other cases I need to compare SPEC_MIN with min ,SPEC_MAX with max and so on.

I searched in SO and google to see how can I do this but all the results I obtained show comparing two columns directly. This is not possible in my case .Because in my case some time I need to compare SPEC_TYP with max and in other cases SPEC_MAX with max and so on.

May I know how to approach this condition.

enter image description here

When I am adding more items I am getting an error ” unexpected indent”

JavaScript

Advertisement

Answer

You can apply different styles to different subsets:

JavaScript

enter image description here

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement