an app that allows me display a data frame and highlight a column
To upload files, please first save the app
import streamlit as st
import pandas as pd
# Sample DataFrame
data = {
'A': [1, 2, 3, 4],
'B': [10, 20, 30, 40],
'C': [100, 200, 300, 400]
}
df = pd.DataFrame(data)
st.title('DataFrame with Highlighted Column')
# Select column to highlight
column_to_highlight = st.selectbox('Select column to highlight:', df.columns)
# Style the DataFrame
styled_df = df.style.apply(lambda x: ['background-color: yellow' if x.name == column_to_highlight else '' for _ in x], axis=0)
# Display the styled DataFrame
st.dataframe(styled_df)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?