UC Davis Python Bootcamp 2021
This three-day course is designed to prepare incoming (or experienced) graduate students with little to no coding experience for the coding demands that many graduate courses and research often require. The bootcamp will take place over September 15th-17th from 6:30pm-8:30pm on campus in the Chemistry Building, Room 172. This is a great opportunity to learn a new skill and meet other graduate students! Snacks and refreshments will be provided. Each session will begin with about an hour of demonstration to teach fundamental Python topics. This will be followed by time where students can work on an assignemnt with each other and ask questions to volunteers. The assignment each day will build off of the previous sessions so by the end you will have a complete Python project!
Any questions about the content of this site should be directed to Nathan Yoshino (ndyoshino@ucdavis.edu).
Masks will be required!
Getting Started
There are multiple ways to use Python. For this workshop no downloads will be necessary - all programming will be done in a browser using Google Colab. However, if you would like to download Python onto your computer and work offline, instructions will be provided below.
Make sure you are logged-in on your browser with a Google account. Cick here to open a new Google Colab notebook. Google Colab will save your files in your Google Drive. Select “New Notebook” at the bottom of the pop-up window. During the presentations, you can follow along and copy what is being demonstrated in your own file and run the code yourself. Here is a brief introduction to some of Colab’s functionalities. If you don’t understand everyting that’s alright. Most importantly, pay attention to the difference between code and text cells, how to run cells of code, and how to move them around.
Note: We will be using Python 3 (the latest version of Python) for this workshop.
Homework Project
Python is very versatile in its applications. The homework will focus on implementing fundamentals introduced in the lectures, working with data, and accessing Python libraries. There will be two homework levels, a standard assignment and an advanced assignment for those that want a challenge. The overall goal of the assignments will be to process data from the 2018 Winter Olympic Games and analyze what factors contribute to success. With the tools we learn, we can even create a model that tries to predict Olympic success in other years!
Agenda
- Day 1 [Recording] ; Lecture notes
- Introduction: What are Coding and Python?
- Variables, Basic Operations and Print
- Lists
- Loops
- NumPy
- Basic Plotting
- Data Importing Day1example.dat
- Resources
- Day 2 [Recording] ; Lecture notes
- Idexing lists
- Arrays
- Conditionals
- Nested Loops
- Functions
- More Plotting finances.dat
Day 2 (Advanced) Homework Assignment
- Day 3
- Real reserach application of Python [Recording] ; Lecture notes, Data File
- Unfortunately, the screen was not recorded today, but you can still follow along by downloading and reading the .ipynb lecture notes.
- Finding Other and Using Other Libraries
- Pandas, Sklearn, UMAP
- Thought Process of Coding and Data Processing
- Finding Other and Using Other Libraries
- Debugging Tutorial [Recording] ; Lecture notes
- Good Coding Practices
- Types of Erroes
- Using Resources
- Print Statements
- Test Cases
Day 3 (Advanced) Homework Assignment
Additional Resources
Downloading Python Offline
One of the easiest ways to download python is through Anaconda. Anaconda is a Python distribution that has extra feautres and packages that make Python easier to use.
- Anaconda Installation Documentation
- Find your operating system in the list, follow the instructions.
- Find where your Anaconda-Navigator was installed located on your computer, open it.
- We recommend using Spyder to run Python
Unlike Colab, there will be one text document without multiple cells (cells can be created). These files are saved as “.py” files instead of “.ipynb” and lack text boxes. The code syntax will be the same as Colab. To run the code, click the green “play” button at the top - all of the code in the document will be run at once instead of just a single cell.
While Loops
- We did not talk about while loops in this course, but they also have their own useful purposes, often times with a conditional.
- Not that infinite loops (getting stuck in a while loop without a way to exit) are a risk when using them!
Classes
- If you followed along through Day 3, we've hinted at the idea of object oriented programming and classes. There was not enough time to cover them in this workshop, but if you continue to explore Python they will be incredibly useful to understand and know how to implement.