在 Python 環境中, Streamlit 模組提供資料分析的網頁服務框架,內建常用的網頁操作控制項,配合 pnadas 資料分析模組,matplotlib 等視覺化模組,可以快速建立互動式網頁服務與企業級儀表板,其功能與 R 語言的 shiny 套件相似。
https://rwepahello.streamlit.app/
佈署時, 須在 app.py 目錄中新增 requirements.txt, 該檔案記錄 app.py 所使用的模組名稱, 參考範例 [https://github.com/rwepa/teaching-streamlit/blob/main/hello_streamlit/requirements.txt]
conda install -c conda-forge streamlit
YouTube: https://youtu.be/FW-dl-flLvk
hello_streamlit 執行方式
考慮建立 D:\streamlitdata\hello_streamlit\app.py
命令提示字元輸入以下內容:
d:
cd streamlitdata\hello_streamlit
streamlit run app.py
執行成果
執行後將自動開啟瀏覽器或於瀏覽器輸入 http://localhost:8501/
Python程式碼
https://github.com/rwepa/teaching-streamlit/tree/main/hello_streamlit
- Streamlit 官網: https://streamlit.io/
- shiny for Python (Python 使用 shiny 模組教學): http://rwepa.blogspot.com/2022/10/shiny-for-python.html
- shiny package 網路應用: http://rwepa.blogspot.com/2013/01/shiny-package.html