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
Have a new JN ready to follow through the live coding in this session.
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 |
There are 3 simply types of data in Python:
int
, e.g. 52, 3, -7) or floats (float
, e.g. 3.7592 or -0.00001)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 ç
.