This lesson is an introduction to programming in Python for people with little or no previous programming experience. It uses plotting as a motivating example. This lesson references the Jupyter Notebook, but can be taught using a regular Python interpreter as well. Please note that this lesson uses Python 3 rather than Python 2.
- Launch the Jupyter Notebook, create new notebooks, and exit the Notebook.
- Explain key differences between integers and floating point numbers.
- Explain key differences between numbers and character strings.
- Explain the purpose of and use built-in functions.
- Use help to display documentation for built-in functions.
- Explain what software libraries are and why programmers create and use them.
- Use Pandas to load a simple CSV data set.
- Create a time series plot showing a single data set.
Following this workshop, join colleagues and peers in the Data Science Center for more in-depth exploration of Python for data analytics.
Python is a popular language for research computing, and great for general-purpose programming as well. Installing all of its research packages individually can be a bit difficult, so we recommend Anaconda, an all-in-one installer.
Regardless of how you choose to install it, please make sure you install Python version 3.x (e.g., 3.6 is fine).
We will teach Python using the Jupyter notebook, a programming environment that runs in a web browser. For this to work you will need a reasonably up-to-date browser. The current versions of the Chrome, Safari and Firefox browsers are all supported (some older browsers, including Internet Explorer version 9 and below, are not).
- Open https://www.anaconda.com/download/#windows with your web browser.
- Download the Python 3 installer for Windows.
- Install Python 3 using all of the defaults for installation except make sure to check Make Anaconda the default Python.
- Open https://www.anaconda.com/download/#macos with your web browser.
- Download the Python 3 installer for OS X.
- Install Python 3 using all of the defaults for installation.
- Open https://www.anaconda.com/download/#linux with your web browser.
- Download the Python 3 installer for Linux.
- (The installation requires using the shell. If you aren't comfortable doing the installation yourself stop here and request help at the workshop.)
- Open a terminal window.
- and then press tab. The name of the file you just downloaded should appear. If it does not, navigate to the folder where you downloaded the file, for example with:
- Then, try again.
- Press enter. You will follow the text-only prompts. To move through the text, press the space key. Type yes and press enter to approve the license. Press enter to approve the default location for the files. Type yes and press enter to prepend Anaconda to your PATH (this makes the Anaconda distribution the default Python).
- Close the terminal window.