[英]How to display excel file in streamlit?
我正在嘗試以流光顯示完整的 excel 數據,但為什么它看起來與原始數據不同?
from streamlit_option_menu import option_menu
import pandas as pd
# 1. as sidebar menu
with st.sidebar:
selected = option_menu("Product", ["BFR CORPORATE", 'BFR mikro', 'BFR Consumer', 'BRF'],
icons=['play', 'play'], menu_icon="cast", default_index=1)
selected
print(selected)
df = pd.read_excel("contoh.xlsx")
st.dataframe(df)
使用安裝為pip install streamlit-aggrid
的Streamlit AgGrid 組件來顯示您的 dataframe。 這可能會解決您面臨的問題。
關於顏色,我很確定必須寫一些CSS來完成。
安裝后,將模塊導入為from st_aggrid import AgGrid
。
from st_aggrid import AgGrid
AgGrid(df)
您可能希望通過AgGrid Doc go了解更多信息,因為它帶有一堆您可能感興趣的特性,關於數據框的樣式。
我建議您訪問streamlit-aggrid 組件,以了解該模塊是如何在 streamlit 中實現的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.