timmy / Streamlit 大規模資料表格與互動編輯
0 Kedvelések
0 forkok
1 fájlok
Utoljára aktív 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 Kedvelések
0 forkok
1 fájlok
Utoljára aktív 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 / 簡單線性回歸股價預測
0 Kedvelések
0 forkok
1 fájlok
Utoljára aktív 10 months ago
這段 Python 程式碼 使用 scikit-learn (sklearn) 建立簡單的線性回歸模型,根據 過去幾天蘋果公司的股價 訓練模型,並 預測未來股價變化。
| 1 | #!/usr/bin/env python |
| 2 | # -*- coding: utf-8 -*- |
| 3 | |
| 4 | |
| 5 | """ |
| 6 | a_simple_linear_regression_model.py: 透過使用 Python 的 sklearn 套件,訓練一個簡單的線性回歸模型,並使用該模型預測蘋果公司的股價變化。 |
| 7 | |
| 8 | Author: Timmy |
| 9 | Copyright: Copyright 2022, Timmy |
| 10 | License: MIT |
Újabb
Régebbi