how to colour a specific cell in pandas dataframe

Solutions on MaxInterview for how to colour a specific cell in pandas dataframe by the best coders in the world

showing results for - "how to colour a specific cell in pandas dataframe"
Matilda
20 Jan 2019
1def color_negative_red(val):
2    """
3    Takes a scalar and returns a string with
4    the css property `'color: red'` for negative
5    strings, black otherwise.
6    """
7    color = 'red' if val < 0 else 'black'
8    return 'color: %s' % color
9