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
6 changes: 3 additions & 3 deletions .translate/state/polars.md.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source-sha: 55c87c9fdbdb522866c5b6bbdc65c073941d7f16
synced-at: "2026-08-18"
source-sha: b0c58ab96a9c537fcf766e4f2d9fd32f4a0fc2f7
synced-at: "2026-10-13"
model: claude-sonnet-5
mode: UPDATE
section-count: 6
tool-version: 0.26.0
tool-version: 0.29.4
8 changes: 6 additions & 2 deletions lectures/polars.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,8 @@ print(f"Polars lazy: {lazy_time:.4f}s")

对经济学家而言,一个重要的数据库是 [FRED](https://fred.stlouisfed.org/)——由圣路易斯联储维护的庞大时间序列数据集。

Polars 的 `read_csv` 可以直接从 URL 获取数据。
我们使用 [requests](https://requests.readthedocs.io/en/latest/) 下载 CSV 文件,
并将其内容传递给 Polars 的 `read_csv`。

我们使用 `try_parse_dates=True` 来自动解析日期列

Expand All @@ -575,7 +576,10 @@ fred_url = ('https://fred.stlouisfed.org/graph/fredgraph.csv?'
'fgst=lin&fgsnd=2020-02-01&line_index=1&'
'transformation=lin&vintage_date=2024-07-29&'
'revision_date=2024-07-29&nd=1948-01-01')
data = pl.read_csv(fred_url, try_parse_dates=True)
import requests

r = requests.get(fred_url)
data = pl.read_csv(r.content, try_parse_dates=True)
```

让我们查看前几行
Expand Down
Loading