dashboard / app.py
Jun Xiong
data
428ae5c
raw
history blame contribute delete
724 Bytes
import streamlit as st
import pandas as pd
# Function to highlight the given value
def highlight_value(val, highlight):
color = 'yellow' if val == highlight else ''
return f'background-color: {color}'
# Value to be highlighted
highlight = "ongoing"
df = pd.read_csv('board.csv')
# Apply the highlighting
df_styled = df.style.applymap(lambda x: highlight_value(x, highlight))
# Convert the styled DataFrame to HTML
df_html = df_styled.set_table_attributes('class="dataframe"')
# Add CSS for setting cell width
css = """
<style>
.dataframe td {
max-width: 100px;
word-wrap: break-word;
}
</style>
"""
# Display the styled DataFrame with custom CSS in Streamlit
st.write(df_html, unsafe_allow_html=True)