Getting Started with Python

ECON 3209 · Week 1, Lecture 1 · Kerala Agricultural University

Department of Development Economics, KAU

Autumn 2026

Learning Outcomes

By the end of this lecture, you will be able to:

  1. Explain what Python is and why economists use it
  2. Launch and navigate a Jupyter Notebook
  3. Run your first Python commands in the browser
  4. Identify the key Python libraries used in this course

What is Python?

A General-Purpose Language

  • Created by Guido van Rossum (1991)
  • Readable, beginner-friendly syntax
  • Massive scientific ecosystem
  • Free and open-source

Why Python for Econometrics?

  • numpy — fast numerical arrays
  • pandas — data wrangling
  • matplotlib / seaborn — charts
  • statsmodels — regression models
  • scipy — statistical tests

💡 Python is now the most popular language for data science worldwide — and is increasingly standard in economics research.

Python vs Other Tools

Feature Python R Stata Excel
Free
General purpose ⚠️
Data wrangling ⚠️
Econometrics
Machine learning
Industry use ⚠️

For this course we use Python — the skills you learn generalise beyond economics to finance, data engineering, and research.

The Python Ecosystem

Scientific Stack - numpy — arrays & math - scipy — statistics - pandas — data tables - matplotlib — plotting - statsmodels — models

Working Environments - Jupyter Notebook.ipynb files - JupyterLab — enhanced IDE - VS Code — popular editor - Spyder — MATLAB-like IDE - Google Colab — cloud notebooks

Your First Python Cell

Try it now! Click ▶ Run below — Python runs directly in your browser. No installation needed.

Jupyter Notebooks

A Jupyter Notebook has two types of cells:

📝 Markdown Cells

  • Write formatted text
  • Add headings, lists, equations
  • Use # Heading, **bold**, *italic*
  • LaTeX math: $y = \beta_0 + \beta_1 x$

💻 Code Cells

  • Type Python code
  • Press Shift + Enter to run
  • Output appears below the cell
  • Cells share a kernel (memory)

Shortcut keys: Shift+Enter (run & advance) · Ctrl+Enter (run in place) · A (insert above) · B (insert below) · M (to markdown) · Y (to code)

Arithmetic in Python

Order of Operations

Python follows standard BODMAS/PEMDAS rules:

The print() Function

Comments in Python

Importing Libraries

Getting Help

Course Software Setup

Installation (for home use)

  1. Download Anaconda from anaconda.com (Python 3.11+)
  2. Launch Jupyter Notebook from Anaconda Navigator
  3. All required packages (numpy, pandas, matplotlib, statsmodels) are included

For Google Colab (no install): colab.research.google.com

In Lectures

All slide decks run Python directly in your browser. No setup needed for class.

🏋️ Exercise

  1. Seconds in a year: \(365 \times 24 \times 60 \times 60\) = ?
  2. Compound interest: ₹10,000 at 8% for 5 years — use \(A = P(1+r)^t\)
  3. print() your name and semester

Summary

Python is free, powerful, and the #1 language for data science

Jupyter Notebooks combine code, output, and explanatory text

✅ Python runs right in this browser — no install needed

✅ Key libraries: numpy · pandas · matplotlib · statsmodels

✅ Standard BODMAS order of operations applies in Python

Comments (#) make code readable — use them generously

Next Lecture

Lecture 2 — Variables & Data Types

We will cover: - Assigning and naming variables - Python’s core data types: int, float, str, bool - Lists, tuples, and dictionaries - Type conversion and checking