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 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.
+
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.
+
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.
Google Colab provides a notebook
@@ -415,14 +427,16 @@
Google Colabusername@mail.csuchico.edu. 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 username@mail.csuchico.edu. 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].
In Week 02, we learned how to summarize numerical variables by themselves. The
latter plots above provide graphical summaries of numerical variables across
a categorical variable. Aggregating, or aggregation, is all about
@@ -1139,10 +1147,10 @@
To follow along with this Lesson, please open the Colab notebook
-Week-04-Notes. The first code cell of this notebook calls to
+Week-04-Notes. 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.
@@ -428,16 +440,17 @@
Graphing detailsWeek
-03. 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.
+reference material on computer software, you should consult the plotnine
+documentation.
+
Let’s continue developing the plot we started at the end of Week
+03. 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.
There are some simple problems with csv files. Imagine a dataset that contains
as values sentences, specifically sentences which possibly contain commas.
@@ -934,80 +935,52 @@
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, folder,
+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, upload_file, 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
+
+
+
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