# based on https://pandas.pydata.org/pandas-docs/version/1.1/user_guide/style.html
import solara
import seaborn as sns
import pandas as pd
import numpy as np
np.random.seed(24)
df = pd.DataFrame({'A': np.linspace(1, 10, 10)})
df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))],
axis=1)
df.iloc[3, 3] = np.nan
df.iloc[0, 2] = np.nan
cm = sns.light_palette("green", as_cmap=True)
df_styled = df.style.background_gradient(cmap=cm)
df_styled
@solara.component
def Page():
# using Jupyter's display mechanism, just as in the notebook
display(df_styled)