Python is a general purpose programming language. This course covers the basics, linear algebra, plotting, and more to prepare students for solving numerical problems with Python. Python is a viable free and open alternative to MATLAB. Prerequisite: Some intro to programming course or equivalent.
This is a 1 credit hour course that was taught in the MAE department at the University of Florida during the Fall 2017 semester. There are fourteen 50 minute lectures.
View the syllabus!
View the course flyer used for advertising the course within the department.
During the 2016 academic year I noticed that there were a large number of students wanting to learn Python. Unfortunately for the students, there are limited opportunities at UF to learn and apply Python. To fill this void, I created a 1 credit hour course on Python tailored for graduate students in the MAE department.
These books were the inspiration for a large portion of the lectures.
- J. VanderPlas. A Whirlwind Tour of Python. O'Reilly Media 2016. https://github.com/jakevdp/WhirlwindTourOfPython http://www.oreilly.com/programming/free/files/a-whirlwind-tour-of-python.pdf
- J. VanderPlas. Python Data Science Handbook: Essential Tools for Working with Data. O'Reilly Media 2016. https://github.com/jakevdp/PythonDataScienceHandbook http://shop.oreilly.com/product/0636920034919.do
- W. McKinney. Python for Data Analysis: Data Wrangling with Pandas, NumPy, and IPython 2nd Edition. O'Reilly Media 2017. http://shop.oreilly.com/product/0636920050896.do https://github.com/wesm/pydata-book
Lectures were performed using the presentation slides along with a Jupyter Notebook. If you are working through this material on your own, I recommend that you interact with the Jupyter Notebook while following through the lecture slides. Jupyter Notebooks can be launched after installing Anaconda (with Spyder) or Canopy. Supplementary material, including files necessary to complete the home work, is available in the lecture folders.
Lecture Description | Slides | Jupyter Notebook | Home Work | Solutions |
---|---|---|---|---|
About Python (2 vs 3), IDEs, IPython , notebooks, and installation | lecture00.pdf | NA | hw00.pdf | NA |
Basics: data types, math, loops | lecture01.pdf | lecture01.ipynb | hw01.pdf | HW01 Solution |
Loops, functions, classes, objects | lecture02.pdf | lecture02.ipynb | hw02.pdf | HW02 Solution |
Objects, Namespace, Python libraries, and pip | lecture03.pdf | lecture03.ipynb | hw03.pdf | HW03 Solution |
Numpy and Matrix operations | lecture04.pdf | lecture04.ipynb | hw04.pdf | HW04 Solution |
More Numpy and Matplotlib for 2D plots (First quiz 15 mins before end of class) | lecture05.pdf | lecture05.ipynb | hw05.pdf | HW05 Solution |
Contour plots, 3D plot, Histograms | lecture06.pdf | lecture06.ipynb | hw06.pdf | HW06 Solution |
Statistical distributions and functions | lecture07.pdf | lecture07.ipynb | hw07.pdf | HW07 Solution |
Optimization in Scipy | lecture08.pdf | lecture08.ipynb | hw08.pdf | HW08 Solution |
Python read and write: opening and modifying text/csv files | lecture09.pdf | lecture09.ipynb | hw09.pdf | HW09 Solution |
Symbolic math with SymPy , DOE with pyDOE (Second quiz 15 mins before end of class) | lecture10.pdf | lecture10.ipynb | hw10.pdf | HW10 Solution |
Scikit-learn: surrogate modeling | lecture11.pdf | lecture11.ipynb | hw11.pdf | HW11 Solution |
Scikit-learn: surrogate modeling and machine learning | lecture12.pdf | lecture12.ipynb | hw12.pdf | HW12 Solution |
Pandas and DataFrames / Review for final | lecture13.pdf | lecture13.ipynb | hw13.pdf | HW13 Solution |
If you are just starting out with Python, I highly recommend installing Anaconda. Anaconda will include the most popular scientific libraries. My favorite text editor / IDE for Python is Visual Studio Code which is free and open source. I have a blog post on how to setup Code for Python. Code has many wonderful features for working with Python, and will help you write Python code that follows the PEP 8 style guide.