Skip to content

Commit

Permalink
A few tiny fixups
Browse files Browse the repository at this point in the history
Some formatting fixups found while running through the tutorial on
codespaces.
  • Loading branch information
jcrist committed Jul 8, 2024
1 parent de2d947 commit bfaf9b0
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
22 changes: 16 additions & 6 deletions 01 - Getting Started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -947,18 +947,28 @@
"### Exercise 4\n",
"\n",
"Add a new column to the `penguins` table with the mean mass of penguins found\n",
"on that island.\n",
"\n",
"```python\n",
"on that island."
]
},
{
"cell_type": "code",
"metadata": {},
"source": [
"mean_mass_per_island = (\n",
" penguins\n",
" .group_by(\"island\")\n",
" .agg(island_mean_mass=penguins.body_mass_g.mean())\n",
")\n",
"\n",
"penguins.join(...) # what goes here?\n",
"```\n",
"\n",
"penguins.join(...) # what goes here?"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Solution"
]
},
Expand Down
8 changes: 6 additions & 2 deletions 03 - Switching Backends.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
"source": [
"basics = con.read_parquet(\n",
" \"data/imdb/imdb_title_basics_sample_5.parquet\", table_name=\"imdb_title_basics\"\n",
")"
")\n",
"\n",
"basics"
],
"execution_count": null,
"outputs": []
Expand All @@ -86,7 +88,9 @@
"source": [
"ratings = con.read_parquet(\n",
" \"data/imdb/imdb_title_ratings.parquet\", table_name=\"imdb_title_ratings\"\n",
")"
")\n",
"\n",
"ratings"
],
"execution_count": null,
"outputs": []
Expand Down
2 changes: 1 addition & 1 deletion quarto/01 - Getting Started.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ left.join(right, "key_column_name")
Add a new column to the `penguins` table with the mean mass of penguins found
on that island.

```python
```{python}
mean_mass_per_island = (
penguins
.group_by("island")
Expand Down
4 changes: 4 additions & 0 deletions quarto/03 - Switching Backends.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ con = ibis.duckdb.connect()
basics = con.read_parquet(
"data/imdb/imdb_title_basics_sample_5.parquet", table_name="imdb_title_basics"
)
basics
```

```{python}
ratings = con.read_parquet(
"data/imdb/imdb_title_ratings.parquet", table_name="imdb_title_ratings"
)
ratings
```

## Exercises
Expand Down
5 changes: 3 additions & 2 deletions solutions/nb01_ex04.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(
mean_mass_per_island = (
penguins
.group_by("island")
.agg(island_mean_mass=penguins.body_mass_g.mean())
.join(penguins, "island")
)

penguins.join(mean_mass_per_island, "island")

0 comments on commit bfaf9b0

Please sign in to comment.