Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions 01.Intro-Python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 01. Python 入門與資料分析

本章節涵蓋 Python 基礎語法、資料分析常用套件 (NumPy、Pandas),以及資料視覺化入門,適合初學者循序漸進學習。

## 📒 教材清單

| 教材 | 說明 | 開啟方式 |
|------|------|----------|
| [Intro_Python-101.ipynb](Intro_Python-101.ipynb) | Python 基礎入門 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/Intro_Python-101.ipynb) |
| [PythonBasic_2.ipynb](PythonBasic_2.ipynb) | Python 基礎語法 (二) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/PythonBasic_2.ipynb) |
| [PythonBasic_3.ipynb](PythonBasic_3.ipynb) | Python 基礎語法 (三) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/PythonBasic_3.ipynb) |
| [PythonBasic_4.ipynb](PythonBasic_4.ipynb) | Python 基礎語法 (四) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/PythonBasic_4.ipynb) |
| [NumPy_Tutorial.ipynb](NumPy_Tutorial.ipynb) | NumPy 數值運算教學 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/NumPy_Tutorial.ipynb) |
| [10分鐘Pandas.ipynb](10分鐘Pandas.ipynb) | 10 分鐘快速學會 Pandas | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/10分鐘Pandas.ipynb) |
| [Python資料分析入門_打底篇.ipynb](Python資料分析入門_打底篇.ipynb) | 資料分析入門 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/Python資料分析入門_打底篇.ipynb) |
| [Python資料分析應用_股票分析入門.ipynb](Python資料分析應用_股票分析入門.ipynb) | 股票資料分析入門 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/Python資料分析應用_股票分析入門.ipynb) |
| [來畫圖好嗎_資料視覺化.ipynb](來畫圖好嗎_資料視覺化.ipynb) | Matplotlib / Seaborn 資料視覺化 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/來畫圖好嗎_資料視覺化.ipynb) |
| [資料視覺化_Dash(人均GDP).ipynb](資料視覺化_Dash(人均GDP).ipynb) | Dash 互動式視覺化 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/資料視覺化_Dash(人均GDP).ipynb) |
| [資料前置處理.ipynb](資料前置處理.ipynb) | 資料清理與前置處理 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/資料前置處理.ipynb) |
| [EDA_Titanic_Survival_Analysis.ipynb](EDA_Titanic_Survival_Analysis.ipynb) | 鐵達尼號探索性資料分析 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/EDA_Titanic_Survival_Analysis.ipynb) |
| [監督學習應用教學.ipynb](監督學習應用教學.ipynb) | 機器學習監督式學習入門 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/監督學習應用教學.ipynb) |
| [Python_ChatGPT_Data_Analysis.ipynb](Python_ChatGPT_Data_Analysis.ipynb) | ChatGPT 輔助資料分析 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/Python_ChatGPT_Data_Analysis.ipynb) |
| [活用JupyterNotebook.ipynb](活用JupyterNotebook.ipynb) | Jupyter Notebook 使用技巧 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/活用JupyterNotebook.ipynb) |
| [亂數報告抽籤.ipynb](亂數報告抽籤.ipynb) | 亂數與隨機應用 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/亂數報告抽籤.ipynb) |
| [112BDA期中報告示範.ipynb](112BDA期中報告示範.ipynb) | 期中報告示範 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/01.Intro-Python/112BDA期中報告示範.ipynb) |

## 🚀 啟動 Jupyter Notebook (本機)

```bash
# 使用 uv (推薦)
uv run --with jupyter jupyter notebook

# 或使用腳本
# Windows
..\scripts\run-jupyter.ps1 -Path "01.Intro-Python"

# macOS/Linux
../scripts/run-jupyter.sh "01.Intro-Python"
```

## 📚 學習建議

1. 建議從 `Intro_Python-101.ipynb` 開始,熟悉 Python 基本語法。
2. 依序學習 `PythonBasic_2` → `3` → `4`,鞏固程式基礎。
3. 再學習 NumPy 與 Pandas,掌握資料處理能力。
4. 最後進入資料視覺化與分析實作,完成完整的資料分析流程。
38 changes: 38 additions & 0 deletions 02.Gradio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 02. Gradio — 互動式 AI 介面

本章節介紹如何使用 [Gradio](https://www.gradio.app/) 快速建立機器學習模型的互動式網頁介面,無需前端開發經驗,適合在 Google Colab 環境中直接執行。

## 📒 教材清單

| 教材 | 說明 | 開啟方式 |
|------|------|----------|
| [gradio_demo.ipynb](gradio_demo.ipynb) | Gradio 互動介面入門示範 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/02.Gradio/gradio_demo.ipynb) |

## 🚀 快速開始

### 在 Google Colab 執行 (推薦)

直接點擊上方的 **Open in Colab** 徽章即可在 Colab 執行,無需本機環境設定。

### 本機執行

```bash
# 使用 uv (推薦)
uv run --with gradio --with jupyter jupyter notebook gradio_demo.ipynb

# 或使用傳統方式
pip install gradio
jupyter notebook gradio_demo.ipynb
```

## 📚 學習重點

- Gradio 基本元件 (Textbox、Image、Audio 等)
- 建立簡易 AI 互動介面
- 在 Colab 分享 Gradio 公開連結
- 結合機器學習模型進行示範

## 🔗 相關資源

- [Gradio 官方文件](https://www.gradio.app/docs/)
- [Gradio GitHub](https://github.com/gradio-app/gradio)
42 changes: 42 additions & 0 deletions 03.Request/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 03. 網頁擷取與 API 資料存取

本章節介紹如何使用 Python `requests` 函式庫進行網頁內容擷取,以及如何透過 API 存取開放資料,適合初學者學習資料蒐集的基礎技巧。

## 📒 教材清單

| 教材 | 說明 | 開啟方式 |
|------|------|----------|
| [網頁擷取_Request.ipynb](網頁擷取_Request.ipynb) | 使用 Requests 進行基礎網頁擷取 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/03.Request/網頁擷取_Request.ipynb) |
| [擷取API資料.ipynb](擷取API資料.ipynb) | API 資料存取與解析 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/03.Request/擷取API資料.ipynb) |
| [RequestsOpenData_HW.ipynb](RequestsOpenData_HW.ipynb) | 開放資料實作練習 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/03.Request/RequestsOpenData_HW.ipynb) |

## 🚀 快速開始

### 在 Google Colab 執行 (推薦)

直接點擊上方的 **Open in Colab** 徽章即可在 Colab 執行,所需套件已預裝於 Colab 環境。

### 本機執行

```bash
# 使用 uv (推薦)
uv run --with requests --with beautifulsoup4 --with jupyter jupyter notebook

# 或使用傳統方式
pip install requests beautifulsoup4
jupyter notebook
```

## 📚 學習重點

- HTTP 請求基礎 (GET / POST)
- 使用 `requests` 抓取網頁 HTML
- 使用 BeautifulSoup 解析 HTML 結構
- 存取 JSON 格式的 REST API
- 解析政府開放資料 (data.gov.tw)

## 🔗 相關資源

- [Requests 官方文件](https://docs.python-requests.org/)
- [BeautifulSoup 文件](https://www.crummy.com/software/BeautifulSoup/bs4/doc/)
- [政府資料開放平臺](https://data.gov.tw/)
62 changes: 62 additions & 0 deletions 04.Playwright/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 04. Playwright — 瀏覽器自動化爬蟲

本章節介紹如何使用 [Playwright](https://playwright.dev/python/) 進行瀏覽器自動化操作,適合處理需要執行 JavaScript 的動態網頁。Playwright 支援錄製腳本功能,可大幅降低撰寫爬蟲的門檻。

## 📒 教材清單

| 教材 | 說明 | 開啟方式 |
|------|------|----------|
| [damun.ipynb](damun.ipynb) | Playwright 實作示範 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/04.Playwright/damun.ipynb) |

## 📁 檔案說明

| 檔案 | 說明 |
|------|------|
| `damun.ipynb` | Playwright 互動式教學筆記本 |
| `damun.py` | Playwright 爬蟲腳本 |
| `damun_33846.json` | 擷取資料範例 |
| `page.json` | 頁面結構範例 |
| `Playwright_proj/` | Playwright 專案範例 |

## 🚀 快速開始

### 安裝 Playwright

```bash
# 使用 uv (推薦)
uv run --with playwright python -m playwright install chromium

# 或使用傳統方式
pip install playwright
playwright install chromium
```

### 執行腳本

```bash
# 使用 uv 執行
uv run --with playwright damun.py

# 或直接執行
python damun.py
```

### 錄製腳本 (Codegen)

```bash
# 啟動錄製模式,操作瀏覽器後自動產生程式碼
playwright codegen https://example.com
```

## 📚 學習重點

- Playwright 安裝與基本設定
- 啟動瀏覽器並導航至網頁
- 定位元素與擷取資料
- 使用 Codegen 錄製操作腳本
- 處理動態載入內容

## 🔗 相關資源

- [Playwright Python 官方文件](https://playwright.dev/python/)
- [Playwright GitHub](https://github.com/microsoft/playwright-python)
74 changes: 74 additions & 0 deletions 04.Selenium/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# 04. Selenium — 動態網頁爬蟲

本章節介紹如何使用 [Selenium](https://www.selenium.dev/) 進行動態網頁的自動化操作與資料擷取,適合需要模擬使用者行為(登入、捲動、點擊)的進階爬蟲需求。

## 📒 教材清單

| 教材 | 說明 | 開啟方式 |
|------|------|----------|
| [網頁擷取_Selenium.ipynb](網頁擷取_Selenium.ipynb) | Selenium 基礎網頁擷取教學 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/04.Selenium/網頁擷取_Selenium.ipynb) |
| [ptt_selenium.ipynb](ptt_selenium.ipynb) | PTT 看板資料爬蟲 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/04.Selenium/ptt_selenium.ipynb) |
| [yahoo_selenium.ipynb](yahoo_selenium.ipynb) | Yahoo 股市資料爬蟲 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/04.Selenium/yahoo_selenium.ipynb) |

## 📁 檔案說明

| 檔案 | 說明 |
|------|------|
| `網頁擷取_Selenium.ipynb` | Selenium 互動式教學筆記本 |
| `ptt_selenium.py` | PTT 爬蟲 Python 腳本 |
| `yahoo_selenium.py` | Yahoo 股市爬蟲 Python 腳本 |
| `ptt_scraping_dag.py` | PTT 爬蟲 DAG 排程腳本 |

## 🚀 快速開始

### 安裝套件

```bash
# 使用 uv (推薦)
uv run --with selenium --with webdriver-manager python ptt_selenium.py

# 或使用傳統方式
pip install selenium webdriver-manager
```

### 安裝瀏覽器驅動程式

Selenium 需要對應瀏覽器的 WebDriver:

- **Chrome**: [ChromeDriver](https://chromedriver.chromium.org/)
- **Firefox**: [GeckoDriver](https://github.com/mozilla/geckodriver)

使用 `webdriver-manager` 可自動下載對應版本的驅動程式:

```python
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager().install())
```

### 執行腳本

```bash
python ptt_selenium.py
python yahoo_selenium.py
```

## 📚 學習重點

- Selenium WebDriver 基本操作
- 定位元素 (CSS Selector、XPath)
- 模擬點擊、輸入、捲動等使用者行為
- 等待頁面載入 (Implicit / Explicit Wait)
- 處理動態 JavaScript 渲染內容

## ⚠️ 注意事項

- 請確認 ChromeDriver 版本與 Chrome 瀏覽器版本相符
- 部分網站對爬蟲有防護機制,請遵守網站使用條款
- 建議加入適當的等待時間,避免請求過於頻繁

## 🔗 相關資源

- [Selenium 官方文件](https://www.selenium.dev/documentation/)
- [webdriver-manager PyPI](https://pypi.org/project/webdriver-manager/)
61 changes: 61 additions & 0 deletions 07.Pytest-DEMO/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 07. Pytest — 自動化測試入門

本章節介紹如何使用 [pytest](https://docs.pytest.org/) 為 Python 程式撰寫自動化測試,涵蓋單元測試、API 測試與測試覆蓋率報告。

## 📒 教材清單

| 教材 | 說明 | 開啟方式 |
|------|------|----------|
| [Pytest_Demo.ipynb](Pytest_Demo.ipynb) | pytest 入門示範 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/07.Pytest-DEMO/Pytest_Demo.ipynb) |

## 📁 檔案說明

| 檔案 | 說明 |
|------|------|
| `Pytest_Demo.ipynb` | pytest 互動式教學筆記本 |
| `my_module.py` | 受測試的模組範例 |
| `test_my_module.py` | 對應的單元測試檔案 |
| `test_tasks_api.py` | Tasks API 測試 |
| `requirements.txt` | 相依套件清單 |

## 🚀 快速開始

### 安裝套件

```bash
# 使用 uv (推薦)
uv pip install -r requirements.txt

# 或使用傳統方式
pip install -r requirements.txt
```

### 執行測試

```bash
# 執行全部測試
pytest

# 執行並顯示詳細資訊
pytest -v

# 執行並產生測試覆蓋率報告
pytest --cov=./

# 產生 HTML 格式的覆蓋率報告
pytest --cov-report=html
```

## 📚 學習重點

- pytest 基本測試寫法
- 測試函式命名慣例 (`test_` 前綴)
- Fixture 的使用
- 參數化測試 (`@pytest.mark.parametrize`)
- API 端點測試
- 測試覆蓋率 (Coverage) 分析

## 🔗 相關資源

- [pytest 官方文件](https://docs.pytest.org/)
- [pytest-cov 插件](https://pytest-cov.readthedocs.io/)
66 changes: 66 additions & 0 deletions 09.Apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 09. 實用應用程式

本章節收錄各種 Python 實用應用範例,包含 QR Code 產生器、OpenAI 應用示範等,可直接在 Google Colab 上執行。

## 📒 教材清單

| 教材 | 說明 | 開啟方式 |
|------|------|----------|
| [QRCode.ipynb](QRCode.ipynb) | QR Code 產生器 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/09.Apps/QRCode.ipynb) |
| [OpenAI_Demo.ipynb](OpenAI_Demo.ipynb) | OpenAI API 應用示範 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/willismax/MediaSystem-Python-Course/blob/main/09.Apps/OpenAI_Demo.ipynb) |

## 📁 檔案說明

| 檔案 | 說明 |
|------|------|
| `QRCode.ipynb` | QR Code 產生器,支援純黑白、彩色背景與 GIF 動態背景 |
| `QRCode.md` | QR Code 應用說明文件 |
| `OpenAI_Demo.ipynb` | OpenAI API 串接示範 |

## 🚀 快速開始

### 在 Google Colab 執行 (推薦)

直接點擊上方的 **Open in Colab** 徽章即可在 Colab 執行。

### QR Code 本機執行

```bash
# 使用 uv (推薦)
uv run --with qrcode --with pillow --with jupyter jupyter notebook QRCode.ipynb

# 或使用傳統方式
pip install qrcode pillow
jupyter notebook QRCode.ipynb
```

### OpenAI Demo 本機執行

> ⚠️ 需要自備 OpenAI API Key

```bash
# 使用 uv (推薦)
uv run --with openai --with jupyter jupyter notebook OpenAI_Demo.ipynb

# 或使用傳統方式
pip install openai
jupyter notebook OpenAI_Demo.ipynb
```

## 📚 學習重點

### QR Code
- 產生純黑白 QR Code
- 加入背景圖片製作彩色 QR Code
- 使用 GIF 動態背景

### OpenAI API
- OpenAI API 基本串接
- 文字生成應用
- 對話式 AI 範例

## 🔗 相關資源

- [qrcode PyPI](https://pypi.org/project/qrcode/)
- [OpenAI API 文件](https://platform.openai.com/docs/)
- [Pillow 文件](https://pillow.readthedocs.io/)
Loading
Loading