Skip to content

Quarto mod2 #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,37 @@ website:
- text: '   12.1. Exercises'
href: modules/module1/module1-32-practicing_bar_charts.qmd
- href: modules/module1/module1-34-what_did_we_just_learn.qmd
- section: "**M2. Not So Scary Wrangling (Table Manipulation and Chaining)**"
contents:
- href: modules/module2/module2-00-module_learning_outcomes.qmd
- href: modules/module2/module2-01-reading_in_different_file_types.qmd
- text: '   1.1. Exercises'
href: modules/module2/module2-02-delimiter.qmd
- href: modules/module2/module2-06-arguments_for_reading_data.qmd
- text: '   2.1. Exercises'
href: modules/module2/module2-07-name_that_argument.qmd
- href: modules/module2/module2-09-column_renaming_and_dropping.qmd
- text: '   3.1. Exercises'
href: modules/module2/module2-10-column_editing_questions.qmd
- href: modules/module2/module2-13-column_arithmetic_and_creation.qmd
- text: '   4.1. Exercises'
href: modules/module2/module2-14-column_arithmetic_questions.qmd
- href: modules/module2/module2-16-data_filtering.qmd
- text: '   5.1. Exercises'
href: modules/module2/module2-17-filtering_question.qmd
- href: modules/module2/module2-20-conditional_value_replacement.qmd
- text: '   6.1. Exercises'
href: modules/module2/module2-21-practice_replacing_values.qmd
- href: modules/module2/module2-22-chaining_notation.qmd
- text: '   7.1. Exercises'
href: modules/module2/module2-23-chaining_true_false.qmd
- href: modules/module2/module2-25-grouping_and_aggregating.qmd
- text: '   8.1. Exercises'
href: modules/module2/module2-26-fruit_salad_grouping_and_aggregating.qmd
- href: modules/module2/module2-29-plotting_with_altair.qmd
- text: '   9.1. Exercises'
href: modules/module2/module2-30-plotting_a_groupby_object.qmd
- href: modules/module2/module2-31-what_did_we_just_learn.qmd

# Since we are declaring options for two formats here (html and revealjs)
# each qmd file needs to include a yaml block including which format to use for that file.
Expand Down
1 change: 1 addition & 0 deletions data/candybars-h.csv
Original file line number Diff line number Diff line change
@@ -0,0 +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
Expand Down
26 changes: 26 additions & 0 deletions data/candybars-text.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name weight chocolate peanuts caramel nougat cookie_wafer_rice coconut white_chocolate multi available_canada_america
Coffee Crisp 50 1 0 0 0 1 0 0 0 Canada
Butterfinger 184 1 1 1 0 0 0 0 0 America
Skor 39 1 0 1 0 0 0 0 0 Both
Smarties 45 1 0 0 0 0 0 0 1 Canada
Twix 58 1 0 1 0 1 0 0 1 Both
Reeses Peanutbutter Cups 43 1 1 0 0 0 0 0 1 Both
3 Musketeers 54 1 0 0 1 0 0 0 0 America
Kinder Surprise 20 1 0 0 0 0 0 1 0 Canada
M & M 48 1 1 0 0 0 0 0 1 Both
Glosettes 50 1 0 0 0 0 0 0 1 Canada
KitKat 45 1 0 0 0 1 0 0 1 Both
Babe Ruth 60 1 1 1 1 0 0 0 0 America
Caramilk 52 1 0 1 0 0 0 0 0 Canada
Aero 42 1 0 0 0 0 0 0 0 Canada
Mars 51 1 0 1 1 0 0 0 0 Both
Payday 52 0 1 1 0 0 0 0 0 America
Snickers 48 1 1 1 1 0 0 0 0 Both
Crunchie 26 1 0 0 0 0 0 0 0 Canada
Wonderbar 58 1 1 1 0 0 0 0 0 Canada
100 Grand 43 1 0 1 0 1 0 0 0 America
Take 5 43 1 1 1 0 1 0 0 0 America
Whatchamacallits 45 1 1 0 0 1 0 0 0 America
Almond Joy 46 1 0 0 0 0 1 0 0 America
Oh Henry 51 1 1 1 0 0 0 0 0 Both
Cookies and Cream 43 0 0 0 0 1 0 1 0 Both
Binary file added data/foods.xlsx
Binary file not shown.
5 changes: 2 additions & 3 deletions environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dependencies:
- scipy
- matplotlib
- jupyter
- quarto
- quarto=1.6.43
- pip


- openpyxl
19 changes: 6 additions & 13 deletions modules/module1/slides/module1_29.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -77,34 +77,27 @@ Now we can use `.value_counts()` on this `mfr_column` variable to reference it,
---

```{python}
mfr_col_wrong = cereal[['mfr']]
mfr_col_wrong
mfr_col_dataframe = cereal[['mfr']]
mfr_col_dataframe
```

<br>

```python
mfr_col_wrong.value_counts()
```{python}
mfr_col_dataframe.value_counts()
```

```out
AttributeError: 'DataFrame' object has no attribute 'value_counts'

Detailed traceback:
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/pandas/core/generic.py", line 5274, in __getattr__
return object.__getattribute__(self, name)
```

:::{.notes}
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.
`value_counts()` can also be called on a DataFrame to count unique rows.
:::

---

## Saving a dataframe

```{python}
# | eval: false
mfr_freq.to_csv('data/mfr_frequency.csv', index=False)
```

Expand Down
29 changes: 29 additions & 0 deletions modules/module2/module2-00-module_learning_outcomes.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
format:
html:
page-layout: full
---

# 0. Module Learning Outcomes

::: {.panel-tabset .nav-pills}

## Video

<iframe
class="video"
src="https://www.youtube.com/embed/rn5t62Utn4U?start=0&end=29&rel=0"
title="Module 2 Video - Module Learning Outcomes"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>

## Slides

<iframe
class="slide-deck"
src="slides/module2_00.html"
></iframe>

:::
29 changes: 29 additions & 0 deletions modules/module2/module2-01-reading_in_different_file_types.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
format:
html:
page-layout: full
---

# 1. Reading in Different File Types

::: {.panel-tabset .nav-pills}

## Video

<iframe
class="video"
src="https://www.youtube.com/embed/WCWi1R2CQsY?start=0&end=270&rel=0"
title="Module 2 Video - Reading in Different File Types"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>

## Slides

<iframe
class="slide-deck"
src="slides/module2_01.html"
></iframe>

:::
Loading
Loading