# 資料異動 (https://nolantw.github.io/tdx/guides/changes/)

## 版本差異

```python
from datetime import date

changes = client.changes.bus_routes("Taipei", start=date(2026, 11, 1))

for change in changes.changes:
    print(change.type, change.keys, change.before, change.after)
```

| 參數 | 比對的版本 |
| --- | --- |
| `start` | 該日與最新版本 |
| `end` | 該日與前一版本 |
| `start` 與 `end` | 兩日的版本，僅限臺北市與新北市的公車 |

`type` 為 `A`（新增）、`M`（修改）或 `D`（刪除），`before` 與 `after` 是 TDX 原本的資料內容。

| 名稱 | 內容 |
| --- | --- |
| `bus_stops` | 市區公車站牌 |
| `bus_routes` | 市區公車路線 |
| `railway_lines` | 臺鐵路線 |
| `railway_stations` | 臺鐵車站 |
| `high_speed_stations` | 高鐵車站 |

## 異動歷程

適用臺北市與新北市的公車站牌與路線：

```python
history = client.changes.bus_route_history(
    "Taipei", "10132", date(2026, 6, 1), date(2026, 11, 1)
)

for revision in history:
    print(revision.start, revision.end, revision.record)
```

路段編碼的異動見[道路](/guides/roads)，所有參數與欄位見[資料異動 API](/reference/changes)。