Welcome

Welcome to this introductory course on how to use Python for data analysis. We will only cover the basics and your skills will slowly build throughout the term.

Prior to today’s session you should have checked the Instructions and successfully installed Jupyter Notebook via Anaconda.

You should know how to

  1. Create a Jupyter Notebook file
  2. Run a code cell

Have a new JN ready to follow through the live coding in this session.

Data

Overview

Basic Terms

Term Equivalent in Economics Example
Variable Like economic notation (Y, X) gdp = 25000
Function Like economic formulas elasticity(quantity_change, price_change)
List Like a data series [gdp_2020, gdp_2021, gdp_2022]
Loop Repeating calculations Calculate growth for each year
Condition Economic logic If inflation > 2%, then…
Library Toolbox of functions pandas for data, matplotlib for graphs

Types of data objects

There are 3 simply types of data in Python:

  1. Numerical. Can be either integers (int , e.g. 52, 3, -7) or floats (float , e.g. 3.7592 or -0.00001)
  2. String. Text (str), which is always written in between ‘’ or “”, for instance "United Kingdom" or 'London' . The difference between the two is that "" allows for special characters outside the standard English alphabet such as ñ or ç .
  3. Object. This is when there is a mixture of string and numerical in that variable.