| country | open | close | GMT | |
|---|---|---|---|---|
| 0 | HK | 8 | 22 | 8 |
| 1 | HK | 7 | 22 | 8 |
| 2 | HK | 8 | 22 | 8 |
| 3 | HK | 8 | 22 | 8 |
| 4 | HK | 8 | 20 | 8 |
The economist’s data analysis skillset.
Do you notice a trend in price?
Do you notice a trend in price?
> was coffee about as expensive in 1980 as it is today?
Do you notice a trend in price?
> no! a dollar today is worth much less than in 1980!
> adjusting for inflation makes the picture clearer
Do you notice a trend in price?
> prices have dropped a lot since 1970 and have been stable since 2000
Is there a trend in the real price of coffee?
Lets transform coffee prices from nominal dollars to real dollars.
Coffee_Prices_CPI.csvHow many shops are opening at any given time?
How many shops are opening at any given time?
Looking at the data is a good place to start.
| country | open | close | GMT | |
|---|---|---|---|---|
| 0 | HK | 8 | 22 | 8 |
| 1 | HK | 7 | 22 | 8 |
| 2 | HK | 8 | 22 | 8 |
| 3 | HK | 8 | 22 | 8 |
| 4 | HK | 8 | 20 | 8 |
>as is common, it’s difficult to understand the raw data on its own
What times do shops open in their local times?
Lets start by looking at what times shops open in local time.
> but does this tell us how many shops are opening at one time?
What times do shops open in GMT?
Lets standardize all times in Greenwich Mean Time (GMT).

> what do the negative values mean?
> hour -1 (1 hour before GMT midnight) is the same as opening at hour 23
Normalize the negative values to 24 hours.
Lets add 24 if the number is negative.

How many shops are opening at any given time?
> a small bump during morning in Europe
> a huge spike during morning in the Americas
> a smaller spike during morning in Asia
How many shops are open at any given time?
How many shops are opening at any given time?
Looking at the data is a good place to start.
| country | open | close | GMT | |
|---|---|---|---|---|
| 0 | HK | 8 | 22 | 8 |
| 1 | HK | 7 | 22 | 8 |
| 2 | HK | 8 | 22 | 8 |
| 3 | HK | 8 | 22 | 8 |
| 4 | HK | 8 | 20 | 8 |
>as is common, it’s difficult to understand the raw data on its own
What times do shops open in their local times?
Lets start by looking at what times shops open in local time.

What times do shops open (GMT)?
Lets standardize all times in Greenwich Mean Time (GMT).

Normalize the negative values to 24 hours.
Lets add 24 if the number is negative.

Q. Is there a relationship between GDP and coffee production?
> a scatterplot effectively visualizes scross sectional data with two dimensions
Which countries produce less coffee per dollar than Brazil?
> separating lines can help make comparisons between ratios
Which countries produce less coffee per dollar than Brazil?
> separating lines can help make comparisons between ratios
Which countries produce more coffee per dollar than Brazil?
> separating lines can help make comparisons between ratios
How does GDP relate to coffee production?
> small values are bunched; large data is very separated
How does GDP relate to coffee production?
> we can fix this by applying a log transformation
How does GDP relate to coffee production?
> looks positive, but we’ll formally test this in Part 4
How does GDP relate to coffee production?
| Code | Year | coffee_prod | Entity | GDP | |
|---|---|---|---|---|---|
| 49 | AGO | 2019 | 0.013257 | Angola | 0.227856 |
| 189 | BOL | 2019 | 0.024841 | Bolivia | 0.098836 |
| 248 | BRA | 2019 | 3.011745 | Brazil | 3.080049 |
| 307 | BDI | 2019 | 0.014059 | Burundi | 0.009110 |
| 416 | CMR | 2019 | 0.034061 | Cameroon | 0.094488 |
How does GDP relate to coffee production?
# Log both x and y variables
gdp['log_GDP'] = np.log(gdp['GDP'])
gdp['log_prod'] = np.log(gdp['coffee_prod'])
How does GDP relate to coffee production?
How does GDP relate to coffee production in the Americas?
> lets use a filter with this data
How does GDP relate to coffee production in the Americas?
>