-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added solutions to all exercises using `%load` - Some minor edits to the code We probably want to add prose around the code bits, but I left that for later.
- Loading branch information
Showing
6 changed files
with
146 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.ipynb_checkpoints | ||
*.ddb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Convert the metric units to imperial, and drop the metric columns. | ||
penguins_imperial = ( | ||
penguins | ||
.mutate( | ||
bill_length_in=penguins.bill_length_mm / 25.4, | ||
bill_depth_in=penguins.bill_depth_mm / 25.4, | ||
flipper_length_in=penguins.flipper_length_mm / 25.4, | ||
body_weight_lb=penguins.body_mass_g / 453.6, | ||
) | ||
.drop( | ||
"bill_length_mm", | ||
"bill_depth_mm", | ||
"flipper_length_mm", | ||
"body_mass_g", | ||
) | ||
) | ||
|
||
penguins_imperial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Convert the metric units to imperial, and drop the metric columns. | ||
penguins_imperial = penguins.select( | ||
"species", | ||
"island", | ||
"sex", | ||
"year", | ||
bill_length_in=penguins.bill_length_mm / 25.4, | ||
bill_depth_in=penguins.bill_depth_mm / 25.4, | ||
flipper_length_in=penguins.flipper_length_mm / 25.4, | ||
body_weight_lb=penguins.body_mass_g / 453.6, | ||
) | ||
|
||
penguins_imperial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# What was the largest female penguin (by body mass) on each island in the year 2008 | ||
sol2 = ( | ||
penguins | ||
.filter( | ||
[ | ||
penguins.sex == "female", | ||
penguins.year == 2008, | ||
] | ||
) | ||
.group_by("island") | ||
.body_mass_g.max() | ||
) | ||
|
||
sol2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
sol3 = ( | ||
penguins | ||
.filter(penguins.sex == "male") | ||
.group_by(["island", "year"]) | ||
.body_mass_g.max() | ||
) | ||
|
||
sol3 |