File size: 724 Bytes
428ae5c c25b09f 428ae5c c25b09f 428ae5c c25b09f 428ae5c c25b09f 428ae5c c25b09f 428ae5c c25b09f 428ae5c c25b09f 428ae5c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
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) |