Skip to content

Commit

Permalink
deploy: 065cba7
Browse files Browse the repository at this point in the history
  • Loading branch information
roualdes committed Jan 4, 2024
1 parent 5bbbab3 commit 7001070
Show file tree
Hide file tree
Showing 50 changed files with 579 additions and 424 deletions.
42 changes: 26 additions & 16 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
</script>

<!-- Loaded before other Sphinx assets -->
<link href="_static/styles/theme.css?digest=5b4479735964841361fd" rel="stylesheet" />
<link href="_static/styles/bootstrap.css?digest=5b4479735964841361fd" rel="stylesheet" />
<link href="_static/styles/pydata-sphinx-theme.css?digest=5b4479735964841361fd" rel="stylesheet" />
<link href="_static/styles/theme.css?digest=bd9e20870c6007c4c509" rel="stylesheet" />
<link href="_static/styles/bootstrap.css?digest=bd9e20870c6007c4c509" rel="stylesheet" />
<link href="_static/styles/pydata-sphinx-theme.css?digest=bd9e20870c6007c4c509" rel="stylesheet" />


<link href="_static/vendor/fontawesome/6.1.2/css/all.min.css?digest=5b4479735964841361fd" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.1.2/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.1.2/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.1.2/webfonts/fa-regular-400.woff2" />
<link href="_static/vendor/fontawesome/6.5.1/css/all.min.css?digest=bd9e20870c6007c4c509" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.1/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.1/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.1/webfonts/fa-regular-400.woff2" />

<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=14f4ca6b54d191a8c7657f6c759bf11a5fb86285" type="text/css" />
Expand All @@ -38,9 +38,9 @@
<link rel="stylesheet" type="text/css" href="_static/design-style.4045f2051d55cab465a707391d5b2007.min.css" />

<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="_static/scripts/bootstrap.js?digest=5b4479735964841361fd" />
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=5b4479735964841361fd" />
<script src="_static/vendor/fontawesome/6.1.2/js/all.min.js?digest=5b4479735964841361fd"></script>
<link rel="preload" as="script" href="_static/scripts/bootstrap.js?digest=bd9e20870c6007c4c509" />
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=bd9e20870c6007c4c509" />
<script src="_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=bd9e20870c6007c4c509"></script>

<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
Expand Down Expand Up @@ -74,7 +74,7 @@



<a class="skip-link" href="#main-content">Skip to main content</a>
<a id="pst-skip-link" class="skip-link" href="#main-content">Skip to main content</a>

<div id="pst-scroll-pixel-helper"></div>

Expand Down Expand Up @@ -117,13 +117,21 @@
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>

<header>

<nav class="bd-header navbar navbar-expand-lg bd-navbar">
</nav>
<div class="bd-header navbar navbar-expand-lg bd-navbar">
</div>

</header>

<div class="bd-container">
<div class="bd-container__inner bd-page-width">





<div class="bd-sidebar-primary bd-sidebar">


Expand Down Expand Up @@ -372,7 +380,7 @@ <h1>MATH131</h1>


<div id="searchbox"></div>
<article class="bd-article" role="main">
<article class="bd-article">

<section class="tex2jax_ignore mathjax_ignore" id="math131">
<h1>MATH131<a class="headerlink" href="#math131" title="Permalink to this heading">#</a></h1>
Expand Down Expand Up @@ -416,6 +424,8 @@ <h1>MATH131<a class="headerlink" href="#math131" title="Permalink to this headin



<div class="bd-sidebar-secondary bd-toc"></div>


</div>
<footer class="bd-footer-content">
Expand Down Expand Up @@ -459,8 +469,8 @@ <h1>MATH131<a class="headerlink" href="#math131" title="Permalink to this headin
</div>

<!-- Scripts loaded after <body> so the DOM is not blocked -->
<script src="_static/scripts/bootstrap.js?digest=5b4479735964841361fd"></script>
<script src="_static/scripts/pydata-sphinx-theme.js?digest=5b4479735964841361fd"></script>
<script src="_static/scripts/bootstrap.js?digest=bd9e20870c6007c4c509"></script>
<script src="_static/scripts/pydata-sphinx-theme.js?digest=bd9e20870c6007c4c509"></script>

<footer class="bd-footer">
</footer>
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
55 changes: 34 additions & 21 deletions _sources/week-00.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,35 @@ kernelspec:

# Week 00: Start here

MATH 131: Introduction to Python is a 1 unit, 5 week course offered at Chico
State through the Department of Mathematics and Statistics. The course consists
Lessons and Assignments. We will learn to code in the programming language
Python using Google Colab notebooks. Lessons, Assignments, and Google Colab
notebooks are discussed in more detail below, and there is a link to a Google
Colab notebook that better introduces this programming environment.
MATH 131: Introduction to Python is a 1 unit, 5 week course offered at
Chico State through the Department of Mathematics and Statistics. The
course consists of Lessons, with accompanying Notes, and Assignments.
We will learn to code in the programming language Python using Google
Colab notebooks.

### Lessons
Lessons are the webpages found on this website, named after each week
of the course. Lessons contain the explanations of what's to come in
the Assignments. You are currently reading the Lesson associated with
Week 00. There is one Lesson for each of the five weeks of this
course.

Lessons found on this website. Lessons contain the explanations of what's to
come in the assignments. Examples and all.
The Lessons have associated Notes. Each Note is a Google
Colab notebook, e.g. Week 01 Notes. Notes are par-baked Colab
notebooks that are meant to provide you with a space to follow along
with the programming in the Lesson. Google Colab notebooks are
discussed in more detail below.

### Assignments
Each week has an Assignment, e.g. Week 02 Assignment, starting with
Week 01. You are responsible for completing the Assignments
throughout the course. Each Lesson will have a link to the associated
Assignment for you to complete.

For assignments, we'll use Google Colab with your [email protected]
account (same password as your [email protected] account).
For assignments, we will use Google Colab with your
[email protected] account (same password as your
[email protected] account).

### Google Colab

## Google Colab

[Google Colab](https://colab.research.google.com) provides a notebook
environment where the user can develop a reproducible document that blends text
Expand All @@ -41,14 +52,16 @@ programming. By combining text and code, you can walk (via text) your audience
through an analysis (usually via code and/or math), showing the exact code you
used to draw any conclusions about the data or otherwise.

We will use Google Colab for free, as part of your campus Google account
[email protected]. The free aspect means we'll have to deal with some
issues that don't otherwise come about if we were to install Python on our own
personal machines. I, Edward, have made the active choice to use Google Colab
instead of teaching you how to install Python on your personal machine,
because I believe we can get started faster this way. If you want to follow
along with this course using different tools, please see the details on the
page [Week 06 and beyond][and-beyond.md].
We will use Google Colab for free, as part of your campus Google
account [email protected]. The free aspect means we'll have
to deal with some issues that don't otherwise come about if we were to
install Python on our own personal machines. I, Edward, have made the
active choice to try Google Colab instead of teaching you how to
install Python on your personal machine, because I believe we can get
started faster this way. If you want to follow along with this course
using different tools, and you understand the consequences you face
for doing so, please see your options on the page [Week 06 and
beyond][./and-beyond.md].

From here, there's really no better way to learn about Google Colab than to go
touch it. Here's a link to [the Colab notebook associated with Week 00: Start
Expand Down
2 changes: 1 addition & 1 deletion _sources/week-03.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ It seems as of 2023-12-23 that `fill`ing by a categorical variable does not work
appropriately if there is any missing data. The plot above works, if you first
drop the NAs.


(aggregating)=
## Aggregating

In Week 02, we learned how to summarize numerical variables by themselves. The
Expand Down
80 changes: 60 additions & 20 deletions _sources/week-04.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ kernelspec:
name: python3
---

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />

# Week 04: Filling in some details

## Learning outcomes
Expand All @@ -27,7 +29,7 @@ After completing this lesson, you will be able to
## Preparation

To follow along with this Lesson, please open the Colab notebook
[Week-04-Notes](#TODO). The first code cell of this notebook calls to
[Week-04-Notes](https://colab.research.google.com/drive/1FvGDi4MQxNzVOJRk6w07RWy3nnGNNF2K?usp=sharing). The first code cell of this notebook calls to
the remote computer, on which the notebook is running, and installs
the necessary packages. For practice, you are repsonible for
importing the necessary packages.
Expand All @@ -38,17 +40,18 @@ In this section, we cover some details about customizing a plotnine plot. This
lesson will not explore all available options, nor are you expected to memorize
all the details we cover. This lesson is intended to be an introduction to the
types of things you can easily change on a plotnine plot. For details and/or
reference material on computer software, you should consult the plotnine
documentation.
reference material on computer software, you should consult the [plotnine
documentation](https://plotnine.readthedocs.io/en/stable/api.html).

Let's continue developing the plot we started at the end of [Week
03](../week-03.md). Our goal is to display information about the mean total
amount of sleep mamals (in our dataset) get, where the data are grouped by their
`vore` status. This is a task for aggregating: group by `vore` and summarize
with the function `np.mean`. Since the mean of any dataset is random, as part
of the random sampling of the data, we should also calculate and display the
error in our estimate associated with the mean. That is, we should display a
confidence interval for the mean.
03](aggregating). Our goal is to display information about the mean
total amount of sleep mamals (in our dataset) get, where the data are
grouped by their `vore` status. This is a task for aggregating: group
by `vore` and summarize `sleep_total` with the function `np.mean`.
Since the mean of any dataset is random, as part of the random
sampling of the data, we should also calculate and display the error
in our estimate associated with the mean. That is, we should display
a confidence interval for the mean.

```{code-cell}
import numpy as np
Expand Down Expand Up @@ -91,7 +94,7 @@ odf["lb"] = odf["mean"] - 1.96 * odf["se"]

Since plotnine plots are created by adding layers of information, let's get
started by creating the variable `p` to hold our plot as we build it up piece by
piece. Below is the code we used from [Week 03](../week-03.md).
piece. Below is the code we used from [Week 03](aggregating).


```{code-cell}
Expand Down Expand Up @@ -155,7 +158,7 @@ information in the data are contained.
By specifying a categorical variable for the keyword argument `color` within
`aes`, the jittered points will show up in unique colors for each category of
the variable specified, `vore` in this case. Further, a legend will
automatically be displayed. Change the category names of the variable `vore` is
automatically be displayed. Changing the category names of the variable `vore` is
best done by renaming the categories, as in [Week 02: Categorical
variables](categorical-variables), but we can easily change the
legend title from plotnine.
Expand Down Expand Up @@ -244,11 +247,6 @@ The main reason behind this is that file paths can be confusing at
first. And so we've delayed this topic until near the end.
Invariably, though, you will need to load your own dataset.

To help you learn about file paths, we have set up a Colab notebook
specific for practicing file paths. Please follow along in the Colab
notebook
[file-paths](https://colab.research.google.com/drive/12q0ostmi7b7LUFOv6srC2xBuN7y7Gz9g?usp=sharing).

### directories

All computers organize their files in **directories**, which are sometimes
Expand Down Expand Up @@ -348,7 +346,7 @@ In a .csv file, the entire table of data above would look as follows.

```{code-cell}
---
tags: [raises-exception]
tags: [raises-exception, remove-output]
---
type,size,color
Expand Down Expand Up @@ -508,8 +506,50 @@ file into a DataFrame, just as we worked with beginning in Week 01.

```{code-cell}
---
tags: [raises-exception]
tags: [raises-exception, remove-output]
---
df = pd.read_csv("./path/to/your/data.csv")
```

#### your data in a Google Colab notebook

When dealing with your own data while working in a Google Colab
notebook, you have to remember that the computer on which your
notebook runs is not the computer in front of you. This means, to
read data into Python, you need to *upload* any dataset onto the Colab
notebook computer.

To upload a dataset to the notebook computer, click on the folder
looking icon, <span class="material-symbols-outlined">folder</span>,
near the top left of the Colab notebook within your browser.
Confusingly, the tooltip you get when hovering over the folder icon
reads Files. Then click the upload file icon, <span
class="material-symbols-outlined">upload_file</span>, to upload the
dataset you want.

Let's say the file you uploaded is named `research_data.csv`. If
upload your dataset into the current working directory on the notebook
computer, then the file path will be `./research_data.csv`, and the
code to read this file into Python, using Pandas, is

```{code-cell}
---
tags: [raises-exception, remove-output]
---
df = pd.read_csv("./research_data.csv")
```

If, before uploading your dataset, you created a new directory named
`data`, and then you uploaded `research_data.csv` into the directory
`data`, the file path will be `./data/research_data.csv`, and the code
to read this file into Python, using Pandas, is

```{code-cell}
---
tags: [raises-exception, remove-output]
---
df = pd.read_csv("/path/to/your/data.csv")
df = pd.read_csv("./data/research_data.csv")
```
Loading

0 comments on commit 7001070

Please sign in to comment.