0

i've a dataframe which looks like this:

count    time  outcount   outtime
 151     9:01    151       9:05   
 198     9:35    190       9:39
  0        -      5        10:25

I want to color entire row where count is not equal to outcount, and print the entire dataframe in python shell. I am able to apply colored formatting in jupyter notebook using following function:

def highlight_greater(x):

y = 'yellow'

m1 = x['count'] != x['outcount']

df1 = pd.DataFrame('background-color: ', index=x.index, columns=x.columns)
df1['count'] = np.where(m1, 'background-color: {}'.format(y), df1['count'])
return df1

df.style.apply(highlight_greater, axis=None)

However, df.style.apply does not work in python shell, can someone guide me how to get the desired result in python shell.

0 Answers0