-
Notifications
You must be signed in to change notification settings - Fork 26
Home

"Get Data Off the Ground with Python," or EngComp1 is the first learning module of the Engineering Computations collection.
Since February 2018, until April 2025, the module was complemented by an open online course in a self-hosted instance of the Open edX learning platform. After seven years, this platform is being taken offline. Here, we reproduce the contents of the "About" page of the online course.
This first module in Engineering Computations (EngComp1) creates a foundation with Python programming, for complete beginners. You learn to handle core data types (strings, lists) and also n-dimensional arrays. The first three lessons have essentially no mathematics, to focus on the programming patterns. The fourth lesson deals with creating and operating on arrays. The final lesson is a worked example of linear regression with real data.
The target audience is first-year engineering students, but the course would be equally useful to students in any science or technology field.
- Play with strings, lists and arrays in Python
- Essential data handling with indexing and slicing
- Create NumPy arrays and operate on them
- Plot your data with Matplotlib
- Apply linear regression to real data and make quality plots
Lorena A. Barba Professor of Mechanical and Aerospace Engineering The George Washington University
- About this course
- Overview
- Get data off the ground
- Jupyter notebooks
- Printable lessons
- Installing Python or using cloud
- References
- Copyright notice
- Interacting with Python
- Get started
- Python as a calculator
- Variables and their type
- Logical and comparison operators
- Play with data in Jupyter
- Working in Jupyter
- Play with Python strings
- Play with Python lists
- Iterations and conditionals
- Graded HW 1
- Graded HW 2
- Graded HW 3
- Graded HW 4
- Strings and lists in action
- Play with text from a website
- What we've learned
- Play with NumPy arrays
- Get started with NumPy
- Multidimensional arrays
- Fast and clean!
- Get started with Matplotlib
- What we've learned
- Graded HW 5
- Graded HW 6
- Linear regression with real data
- Earth temperature over time
- Least-squares linear regression
- Regression with NumPy
- What we've learned
- Graded HW 7
- Graded HW 8
- Graded HW 9
- Graded HW 10
- Final challenge
This is the first in a series of course modules on computation for engineering students. It assumes no previous coding experience, and creates a foundation in programming using essentially no mathematics until the last lesson. The purpose is to concentrate all efforts on establishing coding patterns that will be reused and built on, when applied to technical computing.
It uses the Python programming language, IPython and Jupyter notebooks. All of the tools used are free and open source, and all the materials are open and free.
The module consists of five lessons:
- Interacting with Python
- Play with data in Jupyter
- Strings and lists in action (a full example)
- Play with NumPy arrays
- Linear regression with real data
Students taking this course only need to have interest and commitment to learn. The course can be taken during the first year in university.
Follow the links below to see each lesson rendered by the nbviewer service as a static webpage.
You can also launch an interactive session with the course's Jupyter notebooks using the free Binder service. Try it!
After Binder launches, you should see a Jupyter dashboard (file navigator). Select the folder notebooks_en to access the five lessons of this course as fully executable Jupyter notebooks.
Please note that Binder is a free service from Project Jupyter. Depending on demand, it can be a bit slow. But it's free!
Lesson 1: Interacting with Python
Background: What is Python? Idea of interpreted vs. compiled language. Why use Python? It is a general-purpose and high-productivity language. Getting started: interactive Python (IPython). Using Python as a calculator. New concepts: function, string, variables, assignment, type, special variables (True, False, None). Supported operations, logical operations. Reading error messages.
Lesson 2: Play with data in Jupyter
What is Jupyter? Working with Jupyter. Playing with Python strings: assignment, indexing, slicing. String methods: count, find, index, strip, startswith, split. Play with Python lists: assignment, nested lists, indexing, slicing. String methods: append, index. List membership. Iteration with for-statements. Conditionals.
Lesson 3: Strings and lists in action
A full example using what you learned in lessons 1 and 2: playing with a text file containing the MAE Bulletin (list of courses with their numbers, description, pre-requisites). Reading a data from a file. Cleaning and organizing text data.
Lesson 4: Play with NumPy arrays
Two of the most important libraries for scientific computing with Python: NumPy and Matplotlib. Importing libraries. NumPy functions to create arrays: linspace, ones, zeros, empty, copy. Array operations. Multidimensional arrays. Performance advantage of arrays over lists. Drawing 2D line plots of array data.
Lesson 5: Linear regression with real data
A full worked example using real data of earth temperature over time. Step 1: reading data from a file. Step 2: plotting the data; making beautiful plots. Step 3: least-squares linear regression. Step 4: applying linear regression using NumPy. Split regression.
Why are you using Python?
Python is free. Python is a complete programming solution, with excellent interactive options and visualization tools. Python is a good learning language: it has easy syntax, it is interpreted and it has dynamic typing. Python has a large community: people post and answer each other's questions about Python all the time. For numerical computing, Python libraries can do everything you need to do. Python is exploding in popularity and is used for teaching programming at the top schools. Python is used in industry; it can help you get a job.
I'm having problems viewing the course. Could it be my browser?
The Open edX platform works best with current versions of Chrome, Firefox or Safari, or with Internet Explorer version 9 and above. See the list of supported browsers for the most up-to-date information.
What software do I need for this course?
At first, you can work on this course without any new software: just your browser. We will guide you to use free online resources for interactive computing with Python and Jupyter. For example, you can follow along with our lessons using the free website jupyter.org/try. Bear in mind that it doesn't give you permanent storage: if you create a Jupyter document on this service, be sure to download it before leaving the website.
What is Jupyter?
Jupyter is a set of open-source tools for interactive computing. At the center of the Jupyter world is the Notebook: a document that combines text and multi-media content with executable code. It is a powerful platform to learn computing because it lets you chunk a program into small, digestible portions, and intermix these with narration and explanation. It is also becoming the staple environment to develop ideas and present finished analyses in data science and engineering.
What does it mean that the course materials are open?
It means that the authors of all the materials used in this course give everyone in the world a license to use the material in any way, to redistribute, modify and essentially do whatever they like with it. The only condition is that we are given attribution. Content is under a Creative Commons CC-BY 4.0 International license and code is under a BSD 3-clause license.
Is there a required textbook for this course?
There is no required textbook. We have written up original materials and share them with everyone completely free. You can even download a PDF version for printing. You can cite the typeset document as:
Barba, Lorena A.; Clementi, Natalia C. (2017): Engineering Computations Module 1: Get data off the ground. figshare. doi:10.6084/m9.figshare.5673454
I'm an instructor at another institution. Can I adopt these materials for my course?
Feel free! We're happy if you use the materials in any way. All we ask is that you attribute the materials to us.