Skip to content

Commit 5d4ade0

Browse files
zmx721joelostblom
andauthored
Quarto mod3 (#74)
* remove files not needed for quarto * add basic environment file * quarto file structure and update style * remove sklearn specific style * update quiz background color * update quiz correctAnswers logic * mod 3 * minor fix * update pandas * fix pyodide error * Fix indentation --------- Co-authored-by: Joel Ostblom <[email protected]>
1 parent f9f0fac commit 5d4ade0

28 files changed

+2969
-1
lines changed

_quarto.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,31 @@ website:
110110
- text: '&nbsp;&nbsp; 9.1. Exercises'
111111
href: modules/module2/module2-30-plotting_a_groupby_object.qmd
112112
- href: modules/module2/module2-31-what_did_we_just_learn.qmd
113+
- section: "**M3. Tidy Data and Joining Dataframes**"
114+
contents:
115+
- href: modules/module3/module3-00-module_learning_outcomes.qmd
116+
- href: modules/module3/module3-01-what_is_tidy_data.qmd
117+
- text: '&nbsp;&nbsp; 1.1. Exercises'
118+
href: modules/module3/module3-02-tidy_data_questions.qmd
119+
- href: modules/module3/module3-05-statistical_questions_and_tidy_data.qmd
120+
- text: '&nbsp;&nbsp; 2.1. Exercises'
121+
href: modules/module3/module3-06-which_is_tidy.qmd
122+
- href: modules/module3/module3-08-reshaping_with_pivot.qmd
123+
- text: '&nbsp;&nbsp; 3.1. Exercises'
124+
href: modules/module3/module3-09-pivoting_questions.qmd
125+
- href: modules/module3/module3-11-reshaping_with_pivot_table.qmd
126+
- text: '&nbsp;&nbsp; 4.1. Exercises'
127+
href: modules/module3/module3-12-pivot_table_questions.qmd
128+
- href: modules/module3/module3-14-reshaping_with_melt.qmd
129+
- text: '&nbsp;&nbsp; 5.1. Exercises'
130+
href: modules/module3/module3-15-melting_questions.qmd
131+
- href: modules/module3/module3-17-concatenation.qmd
132+
- text: '&nbsp;&nbsp; 6.1. Exercises'
133+
href: modules/module3/module3-18-concat_questions.qmd
134+
- href: modules/module3/module3-21-joining_dataframes_using_merge.qmd
135+
- text: '&nbsp;&nbsp; 7.1. Exercises'
136+
href: modules/module3/module3-22-merge_questions.qmd
137+
- href: modules/module3/module3-25-what_did_we_just_learn.qmd
113138

114139
# Since we are declaring options for two formats here (html and revealjs)
115140
# each qmd file needs to include a yaml block including which format to use for that file.
@@ -150,4 +175,4 @@ format:
150175
history: false
151176
menu: false
152177
execute:
153-
echo: true
178+
echo: true

data/candy_bars2.csv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name,calories,fat,sugar
2+
Coffee Crisp,260,13,25
3+
Butterfinger,798,30,72
4+
Skor,209,12,23
5+
Smarties,210,6,33
6+
Twix,250,12,25

data/snacksize_candybars.csv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name,calories,fat,sugar
2+
Butterfinger,798,30,72
3+
Skor,209,12,23
4+
Twix,250,12,25
5+
Coffee Crisp,260,13,25
6+
Smarties,210,6,33
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/pILjoN9HSvo?start=0&end=24&rel=0"
16+
title="Module 3 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/module3_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. What is Tidy Data?
8+
9+
::: {.panel-tabset .nav-pills}
10+
11+
## Video
12+
13+
<iframe
14+
class="video"
15+
src="https://www.youtube.com/embed/WCWi1R2CQsY?start=2637&end=2852&rel=0"
16+
title="Module 3 Video - What is Tidy Data?"
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/module3_01.html"
27+
></iframe>
28+
29+
:::
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
format: html
3+
---
4+
5+
<script src='../../src/quiz.js'></script>
6+
7+
# 1.1. Exercises
8+
9+
## Tidy Data Questions
10+
11+
<div id='mcq1'></div>
12+
<script>
13+
generateQuiz(
14+
'mcq1',
15+
'Question 1',
16+
'The same data may be considered tidy for different shaped dataframes depending on the statistical questions .',
17+
{
18+
'True': '',
19+
'False': 'Tidy data depends quite often depends on the statistical question.',
20+
},
21+
'True',
22+
);
23+
</script>
24+
25+
<div id='mcq2'></div>
26+
<script>
27+
generateQuiz(
28+
'mcq2',
29+
'Question 2',
30+
'Which of the following does <b>not</b> characterize a tidy dataset?',
31+
{
32+
'Each row is a single observation': 'You may want to look over this before moving forward.',
33+
'Each column is a single variable': 'You may want to look over this before moving forward.',
34+
'Each value is a single cell': 'You may want to look over this before moving forward.',
35+
'There are no <code>NaN</code> values in the dataset': 'You are right. It is possible to still have tidy data with missing values.',
36+
},
37+
'There are no <code>NaN</code> values in the dataset',
38+
);
39+
</script>
40+
41+
## Is it Tidy I ?
42+
43+
![](../../static/module3/Q3.png){width="85%" fig-alt="404 image" fig-align="center"}
44+
45+
<div id='mcq3'></div>
46+
<script>
47+
generateQuiz(
48+
'mcq3',
49+
'Question 1',
50+
'Given the 3 tidy data criteria, would this dataframe be defined as tidy?',
51+
{
52+
'Yes': 'Not quite! Take a specific look at the column named <code>special_attack_defense</code>. Is this meeting criterion #3?',
53+
'No': 'Good job! Did you notice that <code>special_attack_defense</code> had two values per cell defying criterion #3?',
54+
},
55+
'No',
56+
);
57+
</script>
58+
59+
## Is it Tidy II?
60+
61+
![](../../static/module3/Q4.png){width="85%" fig-alt="404 image" fig-align="center"}
62+
63+
<div id='mcq4'></div>
64+
<script>
65+
generateQuiz(
66+
'mcq4',
67+
'Question 1',
68+
'Given the 3 tidy data criteria, would this dataframe be defined as tidy?',
69+
{
70+
'Yes': 'Not quite! Do you notice anything about the rows? Are they meeting Criterion #1?',
71+
'No': 'Good job! You must have seen the duplicate rows of <code>Ivysaur</code>, <code>Charmeleon</code> and <code>Squirtle</code>.',
72+
},
73+
'No',
74+
);
75+
</script>
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+
# 2. Statistical Questions and Tidy Data
8+
9+
::: {.panel-tabset .nav-pills}
10+
11+
## Video
12+
13+
<iframe
14+
class="video"
15+
src="https://www.youtube.com/embed/WCWi1R2CQsY?start=2855&end=2989&rel=0"
16+
title="Module 3 Video - Statistical Questions and Tidy Data"
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/module3_05.html"
27+
></iframe>
28+
29+
:::
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
format: html
3+
---
4+
5+
<script src='../../src/quiz.js'></script>
6+
7+
# 2.1. Exercises
8+
9+
## Which is Tidy?
10+
11+
12+
**Dataframe A**
13+
14+
![](../../static/module3/Q5a.png){fig-align="center" fig-alt="404 image" width="60%"}
15+
16+
17+
**Dataframe B**
18+
19+
![](../../static/module3/Q5b.png){fig-align="center" fig-alt="404 image" width="60%"}
20+
21+
<div id='mcq1'></div>
22+
<script>
23+
generateQuiz(
24+
'mcq1',
25+
'Which of the above would be considered tidy data for the following statistical questions: ',
26+
'<i>What factors are associated with fruit with seeds?</i>',
27+
{
28+
'Dataframe A': 'Not quite! Maybe try re-reading over the content.',
29+
'Dataframe B': 'Good job!',
30+
},
31+
'Dataframe B',
32+
);
33+
</script>
34+
35+
## Tidy Data True or False
36+
37+
<div id='mcq2'></div>
38+
<script>
39+
generateQuiz(
40+
'mcq2',
41+
'Question 1',
42+
'A long dataframe is always a tidy dataframe.',
43+
{
44+
'True': 'Did you read this section?',
45+
'False': 'Good job! Of course it depends on the statistical question!',
46+
},
47+
'False',
48+
);
49+
</script>
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+
# 3. Reshaping with Pivot
8+
9+
::: {.panel-tabset .nav-pills}
10+
11+
## Video
12+
13+
<iframe
14+
class="video"
15+
src="https://www.youtube.com/embed/WCWi1R2CQsY?start=2991&end=3347&rel=0"
16+
title="Module 3 Video - Reshaping with Pivot"
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/module3_08.html"
27+
></iframe>
28+
29+
:::

0 commit comments

Comments
 (0)