import pandas as pd
import numpy as np
# Create a sample DataFrame
df = pd.DataFrame(np.random.randn(5, 3), columns=['A', 'B', 'C'])
styled_df = df.style
styled_df = df.style.highlight_max(axis=0)
def color_negative_red(val):
color = 'red' if val < 0 else 'green'
return f'color: {color}'
styled_df = df.style.map(color_negative_red)
html = styled_df.to_html()
from IPython.display import display, HTML
display(HTML(html))
df.head()