Mini jupyter-based "textbook" for learning python for data and scientific computing
This is a mini "textbook" derived from the course notes for CIS 161: Computational Science at Grand Valley State University. It is primarily designed to teach Python (specifically Python 3.x) in the context of using Python to solve problems in data, science, and mathematics.
Rather than a traditional textbook, it is meant to be interactive. To allow this, each "chapter" is a jupyter notebook. There are a few different ways you can use this "book".
All of the notebooks are viewable directly online in static form (cannot run and cannot modify). Note, this probably isn't as helpful as running interactively for learning python, but can be helpful if you just need to consult something quick.
This will open up the notebook on Google's Colab. Google Colab is a free service that allows you to run jupyter notebooks online.
- There is no need to install anything
- You can run cells, modify code, and add new cells
- To save your changes you have 2 options:
- save a copy to your Google Drive "File" -> "Save a copy in drive"
- save a copy to your Github "File" -> "Save a copy in github"
- Notes:
- Colab uses a modified version of jupyter notebooks. All of the necessary functionality is there, but some of the options occur in slightly different locations.
- Because this only copies the notebook (not related data files)
you may see minor changes in the code (namely the use of
!wget url
to grab the datasets as well).
This will open up the notebook in myBinder, a free service that allows you to run jupyter notebooks online. However, unlike Google Colab, the notebooks are static (meaning you can run them, but cannot make and save changes.
To download all of the notebooks, click the green "Code" button and either clone it (if you are familiar with git) or click the "Download zip" option to get a zip file of everything.
To download an individual notebook, right click the links the links in the "Download Version" column and select "save link as" (or the equivalent in your browser). To run the notebooks on your local machine, you will need to install python3 and jupyter. There are many ways to install python, but Anaconda Python is often one of the easiest prepackaged python distributions to install that works on Windows, Mac, and Linux.
This "textbook" is meant to be worked with in the order listed below, but you should feel free to jump around or skip sections based on your previous experience with Python.
If you have no previous experience with Python, it is recommended that you work up through section 10 in order. After that, chapters 11 through 15 can be rearranged (with the exception that chapter 13 depends on chapter 12).
# | Topic | Static View | Run Online | Download Version |
---|---|---|---|---|
01 | Intro - coming soon | |||
02 | Basic Python - Variables & Operators | View Online | |
Work Offline |
03 | Using Jupyter Notebooks | View Online | |
Work Offline |
04 | Functions | View Online | |
Work Offline |
05 | Math Module | View Online | |
Work Offline |
06 | Conditionals | View Online | |
Work Offline |
07 | Loops | View Online | |
Work Offline |
08 | Random Module | View Online | |
Work Offline |
09 | Lists | View Online | |
Work Offline |
10 | Strings | View Online | |
Work Offline |
11 | Files | View Online | |
Work Offline |
12 | Tuples | View Online | |
Work Offline |
13 | Dictionaries | View Online | |
Work Offline |
14 | Plotting with Matplotlib | View Online | |
Work Offline |
15 | Numpy | View Online | |
Work Offline |
Dataset licensing:
groundhog.csv
is CCO per the Kaggle page it was obtained fromrobert-frost.csv
is the full text of "Stopping by Woods on a Snowy Evening" by Robert Frost. As of Jan. 1, 2019 it is out of copyright and in the public domaindiabetes.csv
is CC0 per the Kaggle page it was obtained from
The remainder of the work is licensed under CC-BY-NC-SA. See full license text.