d

data-visualization

此範例展示如何使用 Streamlit 處理大量資料,並提供可視化表格 (dataframe) 和可編輯表格 (data_editor) 來動態調整資料。支援圖片預覽、進度條顯示及類別選擇,適用於資料分析與管理應用。

0 0 0 1
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):

此範例展示如何使用 Streamlit 建立互動式數據視覺化,包含多重選擇 (multiselect) 和切換開關 (toggle) 來調整數據顯示,並透過 line_chart 繪製折線圖,讓使用者輕鬆分析數據趨勢。

0 0 0 1
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")

這段 Python Dash 程式碼建立了一個 簡單的網頁應用,包含 下拉選單 (Dropdown),允許使用者選擇 Montréal、Tokyo 或 北京。

0 0 0 1
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(