Skip to content

Commit 8db90e8

Browse files
committed
mod 3
1 parent 62ebaa5 commit 8db90e8

28 files changed

Lines changed: 2967 additions & 7 deletions

_quarto.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,31 @@ website:
3232
style: 'docked'
3333
background: 'primary'
3434
contents:
35-
- section: "**M0. Welcome to Programming in Python for Data Science**"
35+
- section: "**M3. Tidy Data and Joining Dataframes**"
3636
contents:
37-
- text: '0. Welcome!'
38-
href: modules/index.qmd
39-
- href: modules/module0/module0-01-programming_in_python_for_data_science.qmd
40-
- text: '   1.1. Prerequisite confirmation'
41-
href: modules/module0/module0-02-are_you_ready.qmd
42-
- section: "**M1. Python & Pandas - An Unexpected Friendship**"
37+
- href: modules/module3/module3-00-module_learning_outcomes.qmd
38+
- href: modules/module3/module3-01-what_is_tidy_data.qmd
39+
- text: '   1.1. Exercises'
40+
href: modules/module3/module3-02-tidy_data_questions.qmd
41+
- href: modules/module3/module3-05-statistical_questions_and_tidy_data.qmd
42+
- text: '   2.1. Exercises'
43+
href: modules/module3/module3-06-which_is_tidy.qmd
44+
- href: modules/module3/module3-08-reshaping_with_pivot.qmd
45+
- text: '   3.1. Exercises'
46+
href: modules/module3/module3-09-pivoting_questions.qmd
47+
- href: modules/module3/module3-11-reshaping_with_pivot_table.qmd
48+
- text: '   4.1. Exercises'
49+
href: modules/module3/module3-12-pivot_table_questions.qmd
50+
- href: modules/module3/module3-14-reshaping_with_melt.qmd
51+
- text: '   5.1. Exercises'
52+
href: modules/module3/module3-15-melting_questions.qmd
53+
- href: modules/module3/module3-17-concatenation.qmd
54+
- text: '   6.1. Exercises'
55+
href: modules/module3/module3-18-concat_questions.qmd
56+
- href: modules/module3/module3-21-joining_dataframes_using_merge.qmd
57+
- text: '   7.1. Exercises'
58+
href: modules/module3/module3-22-merge_questions.qmd
59+
- href: modules/module3/module3-25-what_did_we_just_learn.qmd
4360

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

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)