create an app with mock data that uses pandas style to customize how a data frame is visualized, add a few examples to show the max in a column, and the min,
Drop files here
or click to upload
import streamlit as st
import pandas as pd
import numpy as np
# Create mock data
np.random.seed(0)
data = pd.DataFrame({
'A': np.random.randint(1, 100, 5),
'B': np.random.randint(1, 100, 5),
'C': np.random.randint(1, 100, 5)
})
st.title("DataFrame Custom Styling Example")
st.write("Original DataFrame:")
st.dataframe(data)
# Highlight max values in each column
styled_max = data.style.highlight_max(color='lightgreen', axis=0)
st.write("DataFrame with Max Values Highlighted:")
st.dataframe(styled_max)
# Highlight min values in each column
styled_min = data.style.highlight_min(color='salmon', axis=0)
st.write("DataFrame with Min Values Highlighted:")
st.dataframe(styled_min)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?