Skip to content

Commit f9f0fac

Browse files
authored
Quarto mod2 (#73)
* remove files not needed for quarto * add basic environment file * quarto file structure and update style * module 2 * remove sklearn specific style * update quiz background color * update pandas to 2.2.3 and other minor fixes * fix pyodide error * minor fix * update error related contents
1 parent 40e07a4 commit f9f0fac

37 files changed

+4242
-16
lines changed

_quarto.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,37 @@ website:
7979
- text: '   12.1. Exercises'
8080
href: modules/module1/module1-32-practicing_bar_charts.qmd
8181
- href: modules/module1/module1-34-what_did_we_just_learn.qmd
82+
- section: "**M2. Not So Scary Wrangling (Table Manipulation and Chaining)**"
83+
contents:
84+
- href: modules/module2/module2-00-module_learning_outcomes.qmd
85+
- href: modules/module2/module2-01-reading_in_different_file_types.qmd
86+
- text: '   1.1. Exercises'
87+
href: modules/module2/module2-02-delimiter.qmd
88+
- href: modules/module2/module2-06-arguments_for_reading_data.qmd
89+
- text: '   2.1. Exercises'
90+
href: modules/module2/module2-07-name_that_argument.qmd
91+
- href: modules/module2/module2-09-column_renaming_and_dropping.qmd
92+
- text: '   3.1. Exercises'
93+
href: modules/module2/module2-10-column_editing_questions.qmd
94+
- href: modules/module2/module2-13-column_arithmetic_and_creation.qmd
95+
- text: '   4.1. Exercises'
96+
href: modules/module2/module2-14-column_arithmetic_questions.qmd
97+
- href: modules/module2/module2-16-data_filtering.qmd
98+
- text: '   5.1. Exercises'
99+
href: modules/module2/module2-17-filtering_question.qmd
100+
- href: modules/module2/module2-20-conditional_value_replacement.qmd
101+
- text: '   6.1. Exercises'
102+
href: modules/module2/module2-21-practice_replacing_values.qmd
103+
- href: modules/module2/module2-22-chaining_notation.qmd
104+
- text: '   7.1. Exercises'
105+
href: modules/module2/module2-23-chaining_true_false.qmd
106+
- href: modules/module2/module2-25-grouping_and_aggregating.qmd
107+
- text: '   8.1. Exercises'
108+
href: modules/module2/module2-26-fruit_salad_grouping_and_aggregating.qmd
109+
- href: modules/module2/module2-29-plotting_with_altair.qmd
110+
- text: '   9.1. Exercises'
111+
href: modules/module2/module2-30-plotting_a_groupby_object.qmd
112+
- href: modules/module2/module2-31-what_did_we_just_learn.qmd
82113

83114
# Since we are declaring options for two formats here (html and revealjs)
84115
# each qmd file needs to include a yaml block including which format to use for that file.

data/candybars-h.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This dataset was created by Hayley Boyce in February 2020.,,,,,,,,,,Note this is not a complete dataset and there are many other candybars that are in existance ,,,,,,,,,,name,weight,chocolate,peanuts,caramel,nougat,cookie_wafer_rice,coconut,white_chocolate,multi,available_canada_americaCoffee Crisp,50,1,0,0,0,1,0,0,0,CanadaButterfinger,184,1,1,1,0,0,0,0,0,AmericaSkor,39,1,0,1,0,0,0,0,0,BothSmarties,45,1,0,0,0,0,0,0,1,CanadaTwix,58,1,0,1,0,1,0,0,1,BothReeses Peanutbutter Cups ,43,1,1,0,0,0,0,0,1,Both3 Musketeers,54,1,0,0,1,0,0,0,0,AmericaKinder Surprise,20,1,0,0,0,0,0,1,0,CanadaM & M,48,1,1,0,0,0,0,0,1,BothGlosettes,50,1,0,0,0,0,0,0,1,CanadaKitKat,45,1,0,0,0,1,0,0,1,BothBabe Ruth,60,1,1,1,1,0,0,0,0,AmericaCaramilk,52,1,0,1,0,0,0,0,0,CanadaAero,42,1,0,0,0,0,0,0,0,CanadaMars,51,1,0,1,1,0,0,0,0,BothPayday,52,0,1,1,0,0,0,0,0,AmericaSnickers,48,1,1,1,1,0,0,0,0,BothCrunchie,26,1,0,0,0,0,0,0,0,CanadaWonderbar ,58,1,1,1,0,0,0,0,0,Canada100 Grand ,43,1,0,1,0,1,0,0,0,AmericaTake 5,43,1,1,1,0,1,0,0,0,AmericaWhatchamacallits,45,1,1,0,0,1,0,0,0,AmericaAlmond Joy,46,1,0,0,0,0,1,0,0,AmericaOh Henry,51,1,1,1,0,0,0,0,0,BothCookies and Cream,43,0,0,0,0,1,0,1,0,Both

data/candybars-text.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name weight chocolate peanuts caramel nougat cookie_wafer_rice coconut white_chocolate multi available_canada_america
2+
Coffee Crisp 50 1 0 0 0 1 0 0 0 Canada
3+
Butterfinger 184 1 1 1 0 0 0 0 0 America
4+
Skor 39 1 0 1 0 0 0 0 0 Both
5+
Smarties 45 1 0 0 0 0 0 0 1 Canada
6+
Twix 58 1 0 1 0 1 0 0 1 Both
7+
Reeses Peanutbutter Cups 43 1 1 0 0 0 0 0 1 Both
8+
3 Musketeers 54 1 0 0 1 0 0 0 0 America
9+
Kinder Surprise 20 1 0 0 0 0 0 1 0 Canada
10+
M & M 48 1 1 0 0 0 0 0 1 Both
11+
Glosettes 50 1 0 0 0 0 0 0 1 Canada
12+
KitKat 45 1 0 0 0 1 0 0 1 Both
13+
Babe Ruth 60 1 1 1 1 0 0 0 0 America
14+
Caramilk 52 1 0 1 0 0 0 0 0 Canada
15+
Aero 42 1 0 0 0 0 0 0 0 Canada
16+
Mars 51 1 0 1 1 0 0 0 0 Both
17+
Payday 52 0 1 1 0 0 0 0 0 America
18+
Snickers 48 1 1 1 1 0 0 0 0 Both
19+
Crunchie 26 1 0 0 0 0 0 0 0 Canada
20+
Wonderbar 58 1 1 1 0 0 0 0 0 Canada
21+
100 Grand 43 1 0 1 0 1 0 0 0 America
22+
Take 5 43 1 1 1 0 1 0 0 0 America
23+
Whatchamacallits 45 1 1 0 0 1 0 0 0 America
24+
Almond Joy 46 1 0 0 0 0 1 0 0 America
25+
Oh Henry 51 1 1 1 0 0 0 0 0 Both
26+
Cookies and Cream 43 0 0 0 0 1 0 1 0 Both

data/foods.xlsx

13.8 KB
Binary file not shown.

environment.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies:
99
- scipy
1010
- matplotlib
1111
- jupyter
12-
- quarto
12+
- quarto=1.6.43
1313
- pip
14-
15-
14+
- openpyxl

modules/module1/slides/module1_29.qmd

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,34 +77,27 @@ Now we can use `.value_counts()` on this `mfr_column` variable to reference it,
7777
---
7878

7979
```{python}
80-
mfr_col_wrong = cereal[['mfr']]
81-
mfr_col_wrong
80+
mfr_col_dataframe = cereal[['mfr']]
81+
mfr_col_dataframe
8282
```
8383

8484
<br>
8585

86-
```python
87-
mfr_col_wrong.value_counts()
86+
```{python}
87+
mfr_col_dataframe.value_counts()
8888
```
8989

90-
```out
91-
AttributeError: 'DataFrame' object has no attribute 'value_counts'
92-
93-
Detailed traceback:
94-
File "<string>", line 1, in <module>
95-
File "/usr/local/lib/python3.7/site-packages/pandas/core/generic.py", line 5274, in __getattr__
96-
return object.__getattribute__(self, name)
97-
```
9890

9991
:::{.notes}
100-
If we did instead use double square brackets with `pd.value_counts()`, we would get an error. So it is important to take care and remember when you are using `value_counts()`, you only use one set of square brackets.
92+
`value_counts()` can also be called on a DataFrame to count unique rows.
10193
:::
10294

10395
---
10496

10597
## Saving a dataframe
10698

10799
```{python}
100+
# | eval: false
108101
mfr_freq.to_csv('data/mfr_frequency.csv', index=False)
109102
```
110103

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
format:
3+
html:
4+
page-layout: full
5+
---
6+
7+
# 0. Module Learning Outcomes
8+
9+
::: {.panel-tabset .nav-pills}
10+
11+
## Video
12+
13+
<iframe
14+
class="video"
15+
src="https://www.youtube.com/embed/rn5t62Utn4U?start=0&end=29&rel=0"
16+
title="Module 2 Video - Module Learning Outcomes"
17+
frameborder="0"
18+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
19+
allowfullscreen
20+
></iframe>
21+
22+
## Slides
23+
24+
<iframe
25+
class="slide-deck"
26+
src="slides/module2_00.html"
27+
></iframe>
28+
29+
:::
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
format:
3+
html:
4+
page-layout: full
5+
---
6+
7+
# 1. Reading in Different File Types
8+
9+
::: {.panel-tabset .nav-pills}
10+
11+
## Video
12+
13+
<iframe
14+
class="video"
15+
src="https://www.youtube.com/embed/WCWi1R2CQsY?start=0&end=270&rel=0"
16+
title="Module 2 Video - Reading in Different File Types"
17+
frameborder="0"
18+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
19+
allowfullscreen
20+
></iframe>
21+
22+
## Slides
23+
24+
<iframe
25+
class="slide-deck"
26+
src="slides/module2_01.html"
27+
></iframe>
28+
29+
:::

0 commit comments

Comments
 (0)