Econ 294A, Spring 2024
This course aims to offer students a comprehensive introduction to Python, with a special emphasis on its applications within Economics and Data Science. Our objective is to build foundational programming skills and cover a broad selection of Python packages, equipping students with prior exposure to leverage Python for a wide range of applications.
- Main Instructor: Pedro Vallocci
- Office Hours: Wednesday, 2:30PM - 4:30PM at E2-405C
- Contact: pbrazval@ucsc.edu
- Lecture: Section 1: Tuesdays, 5:20 PM - 6:55 PM @ Crown Clrm 105;
Section 2: Thursdays, 5:20 PM - 6:55 PM @ Crown Clrm 104
- Course Website: Canvas
Several references on Python usually focus on specific packages or use cases. The main benefit of checking a book or a package documentation link when in doubt, as a complement to Stack Overflow and ChatGPT, is serendipity -- you'll probably learn more than what you were looking for.
You don't need to buy any of the following books. They will cover a wider range of topics than we can cover in class.
-
Matthes, Eric. Python Crash Course. 3rd edition.
-
McKinney, Wes. Python for Data Analysis. 2nd edition.
-
Ramalho, Luciano. Fluent Python. 2nd edition.
-
G'{e}ron, Aur'{e}lien. Hands-on Machine Learning with Scikit-Learn, Keras & TensorFlow. 3rd edition.
The official documentation links for some common packages are below. Python is a very well-documented language. If you don't understand the logic of a function, checking its documentation from the source will be useful. You'll also stumble upon new functions from the same package that may help you in future coding -- rather than reinventing the wheel, you can find a pythonic way of elegantly coding what you want.
- Numpy: https://numpy.org/doc/stable/index.html
- Pandas: https://pandas.pydata.org/docs/index.html
- Statsmodels: https://www.statsmodels.org/stable/index.html
- Matplotlib: https://matplotlib.org/stable/
Especially for base Python, Numpy, and Pandas, I recommend having printed cheat sheets close by while coding, as they will help you remember common function names more easily. Check Canvas for the added files.
-
Lecture 1: Introduction to Python
- Why Python?
- Data structures in Python
- Basic commands
- Loops and conditional statements
-
Lecture 2: Loading Datasets: Pandas and Numpy
- Introduction to Pandas
- Data import and export using Pandas
- Matrix/Linear algebra using Numpy
- Combining Pandas and Numpy
-
Lecture 3: Data Visualization and Data Analysis
- Interacting with Web APIs
- Working with Pandas plot, Matplotlib, and Seaborn
-
Lecture 4: Statsmodels
-
Lecture 5: Working with Panel Data and Time Series
- Statsmodels
- Linearmodels
- Prophet
-
Lecture 6: Version Control
- Git
- Uploading your portfolio to GitHub
-
Lecture 7: Web Scraping and Text Mining Using Python
- Basic web scraping
- Text mining in Python
-
Lecture 8: Advanced Web Scraping
- BeautifulSoup, Selenium, and Scrapy
-
Lecture 9: Natural Language Processing
- SpaCy
- Gensim
-
Lecture 10: Introduction to Scikit-Learn and TensorFlow
- Regression analysis
- Machine Learning
- Extensions
- Ensemble Learning