this is my style code to make positive numbers appear green and negative numbers appear red if i just print out df it would show the numbers like this:
25.72,36.28,0.17
with the style however they are displayed like this: 25.7200000, 36.2800000, 0.1700000
how would i make them appear like before but with the colorful style? thank you for your help im really new to python
def color_negative_red(value):
if isinstance(value, str):
color = 'black'
return 'color: %s' % color
if isinstance(value, float):
if value > 0:
color = "green"
return 'color: %s' % color
if value < 0:
color = "red"
return 'color: %s' % color
df.style.applymap(color_negative_red)