Skip to content

Commit d2c0255

Browse files
Merge pull request #193 from tidy-finance/remove-pandas-datareader
remove pandas-datareader from accessing and managing financial data
2 parents fc9938b + f66792c commit d2c0255

File tree

10 files changed

+851
-520
lines changed

10 files changed

+851
-520
lines changed

_freeze/python/accessing-and-managing-financial-data/execute-results/html.json

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

_freeze/r/accessing-and-managing-financial-data/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

docs/accessing-and-managing-financial-data.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
var hash = window.location.hash.startsWith('#') ? window.location.hash.slice(1) : window.location.hash;
77
var redirect = redirects[hash] || redirects[""] || "/";
88
window.document.title = 'Redirect to ' + redirect;
9+
if (!redirects[hash]) {
10+
redirect = redirect + window.location.hash;
11+
}
12+
redirect = redirect + window.location.search;
913
window.location.replace(redirect);
1014
</script>
1115
</head>

docs/python/accessing-and-managing-financial-data.html

Lines changed: 509 additions & 262 deletions
Large diffs are not rendered by default.

docs/r/accessing-and-managing-financial-data.html

Lines changed: 157 additions & 148 deletions
Large diffs are not rendered by default.

docs/search.json

Lines changed: 7 additions & 7 deletions
Large diffs are not rendered by default.

docs/sitemap.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
</url>
215215
<url>
216216
<loc>https://www.tidy-finance.org/python/accessing-and-managing-financial-data.html</loc>
217-
<lastmod>2025-09-04T10:41:27.789Z</lastmod>
217+
<lastmod>2025-12-07T22:27:22.252Z</lastmod>
218218
</url>
219219
<url>
220220
<loc>https://www.tidy-finance.org/python/changelog.html</loc>
@@ -274,7 +274,7 @@
274274
</url>
275275
<url>
276276
<loc>https://www.tidy-finance.org/r/accessing-and-managing-financial-data.html</loc>
277-
<lastmod>2025-09-04T08:29:23.489Z</lastmod>
277+
<lastmod>2025-12-07T22:27:49.384Z</lastmod>
278278
</url>
279279
<url>
280280
<loc>https://www.tidy-finance.org/r/changelog.html</loc>

python/accessing-and-managing-financial-data.qmd

Lines changed: 154 additions & 81 deletions
Large diffs are not rendered by default.

r/accessing-and-managing-financial-data.qmd

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -241,30 +241,28 @@ We can then use the `httr2` [@httr2] package to request the CSV, extract the dat
241241
#| message: false
242242
library(httr2)
243243
244-
cpi_daily <- request(cpi_url) |>
245-
req_perform() |>
246-
resp_body_string() |>
244+
resp <- request(cpi_url) |>
245+
req_perform()
246+
resp_csv <- resp |>
247+
resp_body_string()
248+
249+
cpi_monthly <- resp_csv |>
247250
read_csv() |>
248251
mutate(
249252
date = as.Date(observation_date),
250253
value = as.numeric(.data[[series]]),
251254
series = series,
252255
.keep = "none"
253-
)
254-
```
255-
256-
We convert the daily CPI data to monthly because we use the latter in later chapters.
257-
258-
```{r}
259-
cpi_monthly <- cpi_daily |>
256+
) |>
257+
filter(date >= start_date & date <= end_date) |>
260258
mutate(
261-
date = floor_date(date, "month"),
262-
cpi = value / value[date == max(date)],
263-
.keep = "none"
259+
cpi = value / value[date == max(date)]
264260
)
265261
```
266262

267-
The `tidyfinance` package can, of course, also fetch the same daily data and many more data series:
263+
The last line sets the current (latest) price level as the reference price level.
264+
265+
The `tidyfinance` package can, of course, also fetch the same index data and many more data series:
268266

269267
```{r}
270268
#| message: false

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ statsmodels==0.14.4
145145
tabulate==0.9.0
146146
terminado==0.17.1
147147
threadpoolctl==3.2.0
148-
tidyfinance==0.1.2
148+
tidyfinance==0.2.4
149149
tinycss2==1.2.1
150150
tomli==2.0.1
151151
tornado==6.3.3

0 commit comments

Comments
 (0)