-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathPWT_data_input.py
More file actions
39 lines (31 loc) · 967 Bytes
/
PWT_data_input.py
File metadata and controls
39 lines (31 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
Penn World Table
http://www.rug.nl/research/ggdc/data/pwt/
Prepared for Data Bootcamp course at NYU
* https://github.com/NYUDataBootcamp/Materials
* https://github.com/NYUDataBootcamp/Materials/Code/Lab
Written by Dave Backus, January 2016
Created with Python 3.5
"""
import pandas as pd
# data input
url = 'http://www.rug.nl/research/ggdc/data/pwt/v81/pwt81.xlsx'
pwt = pd.read_excel(url,
sheetname='Data',
parse_cols=[0,1,3,5,6,7,8,14,17,20])
list(pwt)
#%%
# create smaller spreadsheet for teaching
pwt['rgdpna'] = pwt['rgdpna']/1000.0
pwt['rkna'] = pwt['rkna']/1000.0
nyu = pwt[[1,0,2]].copy()
nyu['POP'] = pwt['pop']
nyu['L/POP'] = pwt['emp']/pwt['pop']
nyu['Y/POP'] = pwt['rgdpna']/pwt['pop']
nyu['Y/L'] = pwt['rgdpna']/pwt['emp']
nyu['K/L'] = pwt['rkna']/pwt['emp']
nyu['K/Y'] = pwt['rkna']/pwt['rgdpna']
nyu['Hours'] = pwt['avh']
#%%
nyu.to_excel('pwt81_nyustern.xls', index=False, sheet_name='PWT 8.1')
#%%