Skip to content

Commit 8f54e6c

Browse files
committed
Fix quarto notebooks
1 parent dab5d4b commit 8f54e6c

File tree

4 files changed

+22
-31
lines changed

4 files changed

+22
-31
lines changed

template/.gitignore.jinja

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,6 @@ venv.bak/
6969
packrat/lib*/
7070
packrat/src/
7171

72-
# renv
73-
renv/library/
74-
renv/local/
75-
renv/cellar/
76-
renv/lock/
77-
renv/python/
78-
renv/staging/
79-
8072
{% endif %}
8173

8274
# IDEs
@@ -99,3 +91,6 @@ Thumbs.db
9991
{% if python_package %}site/
10092
{% endif %}{% if python_data_science %}.quarto/
10193
{% endif %}tmp/
94+
95+
_site
96+
_freeze

template/{% if python_data_science or r_data_science %}notebooks{% endif %}/index.qmd.jinja

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,18 @@ format: html
8282

8383
Then you write in **Markdown** with optional **code blocks**:
8484

85-
````markdown
85+
````{markdown eval="false"}
8686
# My Analysis
8787

8888
Some text here.
8989

90-
{% if python_data_science and r_data_science %}```{python}
90+
{% if python_data_science %}```{python}
9191
print("Hello from Python!")
9292
```
93-
94-
```{r}
93+
{% endif %}{% if r_data_science %}```{r}
9594
print("Hello from R!")
96-
```{% elif python_data_science %}```{python}
97-
print("Hello, Quarto!")
98-
```{% elif r_data_science %}```{r}
99-
print("Hello, Quarto!")
100-
```{% endif %}
95+
```
96+
{% endif %}
10197

10298
More text here.
10399
````

template/{% if python_data_science or r_data_science %}notebooks{% endif %}/{% if python_data_science %}py_example.qmd{% endif %}

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import numpy as np
2020

2121
# Set up plotting style
2222
sns.set_theme(style="whitegrid")
23-
plt.rcParams['figure.figsize'] = (10, 6)
23+
plt.rcParams["figure.figsize"] = (10, 6)
2424
```
2525

2626
## Create Sample Data
@@ -125,18 +125,19 @@ Let's demonstrate some more advanced Polars functionality:
125125
```{python}
126126
# Window functions and complex aggregations
127127
advanced_analysis = (
128-
data
129-
.with_columns([
130-
# Add rank within each category
131-
pl.col("value").rank().over("category").alias("value_rank"),
132-
# Add rolling mean
133-
pl.col("score").rolling_mean(window_size=50).alias("score_rolling_mean"),
134-
# Add conditional column
135-
pl.when(pl.col("value") > pl.col("value").mean())
136-
.then(pl.lit("Above Average"))
137-
.otherwise(pl.lit("Below Average"))
138-
.alias("value_category")
139-
])
128+
data.with_columns(
129+
[
130+
# Add rank within each category
131+
pl.col("value").rank().over("category").alias("value_rank"),
132+
# Add rolling mean
133+
pl.col("score").rolling_mean(window_size=50).alias("score_rolling_mean"),
134+
# Add conditional column
135+
pl.when(pl.col("value") > pl.col("value").mean())
136+
.then(pl.lit("Above Average"))
137+
.otherwise(pl.lit("Below Average"))
138+
.alias("value_category"),
139+
]
140+
)
140141
.filter(pl.col("score") > 25) # Filter for scores > 25
141142
.sort("value", descending=True)
142143
)

template/{% if python_data_science or r_data_science %}notebooks{% endif %}/{% if r_data_science %}r_example.qmd{% endif %}

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: "A Quarto Page Layout Example"
33
subtitle: "Inspired by Tufte Handout, Using Quarto"
44
date: "`r Sys.Date()`"
55
format:
6-
pdf: default
76
html:
87
self-contained: true
98
grid:

0 commit comments

Comments
 (0)