timmy / Streamlit 大規模資料表格與互動編輯
0 喜歡
0 分支
1 檔案
最後活躍 10 months ago
此範例展示如何使用 Streamlit 處理大量資料,並提供可視化表格 (dataframe) 和可編輯表格 (data_editor) 來動態調整資料。支援圖片預覽、進度條顯示及類別選擇,適用於資料分析與管理應用。
| 1 | import streamlit as st |
| 2 | import pandas as pd |
| 3 | import numpy as np |
| 4 | |
| 5 | st.write("Got lots of data? Great! Streamlit can show [dataframes](https://docs.streamlit.io/develop/api-reference/data) with hundred thousands of rows, images, sparklines – and even supports editing! ✍️") |
| 6 | |
| 7 | num_rows = st.slider("Number of rows", 1, 10000, 500) |
| 8 | np.random.seed(42) |
| 9 | data = [] |
| 10 | for i in range(num_rows): |
timmy / Streamlit 資料視覺化與互動選擇
0 喜歡
0 分支
1 檔案
最後活躍 10 months ago
此範例展示如何使用 Streamlit 建立互動式數據視覺化,包含多重選擇 (multiselect) 和切換開關 (toggle) 來調整數據顯示,並透過 line_chart 繪製折線圖,讓使用者輕鬆分析數據趨勢。
| 1 | import streamlit as st |
| 2 | import pandas as pd |
| 3 | import numpy as np |
| 4 | |
| 5 | st.write("Streamlit supports a wide range of data visualizations, including [Plotly, Altair, and Bokeh charts](https://docs.streamlit.io/develop/api-reference/charts). 📊 And with over 20 input widgets, you can easily make your data interactive!") |
| 6 | |
| 7 | all_users = ["Alice", "Bob", "Charly"] |
| 8 | with st.container(border=True): |
| 9 | users = st.multiselect("Users", all_users, default=all_users) |
| 10 | rolling_average = st.toggle("Rolling average") |
timmy / Dash 下拉選單範例
0 喜歡
0 分支
1 檔案
最後活躍 10 months ago
這段 Python Dash 程式碼建立了一個 簡單的網頁應用,包含 下拉選單 (Dropdown),允許使用者選擇 Montréal、Tokyo 或 北京。
| 1 | # -*- coding: utf-8 -*- |
| 2 | |
| 3 | import dash |
| 4 | from dash import html |
| 5 | from dash import dcc |
| 6 | |
| 7 | print(dcc.__version__) |
| 8 | external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"] |
| 9 | |
| 10 | app = dash.Dash( |
上一頁
下一頁