update EPU

This commit is contained in:
TerenceLiu98 2023-04-20 20:24:33 +08:00
parent e09a821d69
commit 1f86624b26
1 changed files with 4 additions and 5 deletions

View File

@ -3,9 +3,8 @@ import requests
import pandas as pd import pandas as pd
url = { url = {
"EPU-China": "https://economicpolicyuncertaintyinchina.weebly.com", "EPU-China": "https://www.policyuncertainty.com/media/SCMP_China_Policy_Uncertainty_Data.xlsx",
"EPU-HKSAR": "https://economicpolicyuncertaintyinchina.weebly.com/epu-in-hong-kong.html", "EPU-HKSAR": "https://www.policyuncertainty.com/media/HK_EPU_Data_Annotated.xlsx",
"EPU-MACAUSAR": "https://economicpolicyuncertaintyinchina.weebly.com/epu-in-macao.html",
"EPU": "https://www.policyuncertainty.com/" "EPU": "https://www.policyuncertainty.com/"
} }
@ -52,7 +51,7 @@ class EPUData(object):
output_data.append(pd.read_excel(urls_data[i])) output_data.append(pd.read_excel(urls_data[i]))
return {"data":output_data, "reference":urls_cite} return {"data":output_data, "reference":urls_cite}
'''
elif self.country == "MACAUSAR": elif self.country == "MACAUSAR":
r = requests.get(url["EPU-MACAUSAR"]) r = requests.get(url["EPU-MACAUSAR"])
webpage = html.fromstring(r.content) webpage = html.fromstring(r.content)
@ -66,7 +65,7 @@ class EPUData(object):
output_data.append(pd.read_excel(urls_data[i])) output_data.append(pd.read_excel(urls_data[i]))
return {"data":output_data, "reference":urls_cite} return {"data":output_data, "reference":urls_cite}
'''
else: else:
r = requests.get(url["EPU"] + self.country.lower() + "_monthly.html") r = requests.get(url["EPU"] + self.country.lower() + "_monthly.html")
webpage = html.fromstring(r.content) webpage = html.fromstring(r.content)