= 'Tarek A. Hassan, Stephan Hollander, Laurence van Lent, Ahmed Tahoun, 2019'
PROVIDER = 'https://www.dropbox.com/s/96xo9f1twlu3525/firmquarter_2022q1.csv?raw=1'
URL = 'https://www.firmlevelrisk.com/'
HOST_WEBSITE = 'Q'
FREQ = 2002
MIN_YEAR = 2022
MAX_YEAR = 'gvkey'
ENTITY_ID_IN_RAW_DSET = 'permno'
ENTITY_ID_IN_CLEAN_DSET = 'date'
TIME_VAR_IN_RAW_DSET = f'{FREQ}date' TIME_VAR_IN_CLEAN_DSET
Hassan, et al. (2019)
This module downloads and processes data developed by:
- Tarek A. Hassan, Stephan Hollander, Laurence van Lent, Ahmed Tahoun, 2019, “Firm-Level Political Risk: Measurement and Effects,” Quarterly Journal of Economics, 134 (4), pp.2135-2202. https://doi.org/10.1093/qje/qjz021.
The dataset also contains data developed by the papers below:
Tarek A. Hassan, Stephan Hollander, Laurence van Lent, Ahmed Tahoun, “The Global Impact of Brexit Uncertainty,” 2020, NBER Working Paper 26609
Tarek A. Hassan, Stephan Hollander, Laurence van Lent, Markus Schwedeler, Ahmed Tahoun, “Firm-level Exposure to Epidemic Diseases: Covid-19, SARS, and H1N1,” 2020, mimeo London Business School. Avilable at SSRN: https://ssrn.com/abstract=3566530
See the authors’ dedicated website for more information on this dataset: https://www.firmlevelrisk.com/
list_all_vars
list_all_vars (url:str='https://www.dropbox.com/s/96xo9f1twlu3525/firmqua rter_2022q1.csv?raw=1', delimiter:str='\t')
= list_all_vars()
alv alv.head()
name | |
---|---|
0 | gvkey |
1 | date |
2 | PRisk |
3 | NPRisk |
4 | Risk |
print(list(alv.name))
['gvkey', 'date', 'PRisk', 'NPRisk', 'Risk', 'PSentiment', 'NPSentiment', 'Sentiment', 'PRiskT_economic', 'PRiskT_environment', 'PRiskT_trade', 'PRiskT_institutions', 'PRiskT_health', 'PRiskT_security', 'PRiskT_tax', 'PRiskT_technology', 'company_name', 'hqcountrycode', 'isin', 'cusip', 'ticker', 'date_earningscall', 'Covid_Exposure', 'Covid_Neg_Sentiment', 'Covid_Pos_Sentiment', 'Covid_Net_Sentiment', 'Covid_Risk', 'SARS_Exposure', 'H1N1_Exposure', 'Zika_Exposure', 'Ebola_Exposure', 'Brexit_Exposure', 'Brexit_Neg_Sentiment', 'Brexit_Pos_Sentiment', 'Brexit_Net_Sentiment', 'Brexit_Risk']
get_raw_data
get_raw_data (url:str='https://www.dropbox.com/s/96xo9f1twlu3525/firmquar ter_2022q1.csv?raw=1', nrows:int=None, delimiter:str='\t')
Download raw data from url
Type | Default | Details | |
---|---|---|---|
url | str | https://www.dropbox.com/s/96xo9f1twlu3525/firmquarter_2022q1.csv?raw=1 | |
nrows | int | None | How many rows to download. If None, all rows are downloaded |
delimiter | str | ||
Returns | pd.DataFrame |
= get_raw_data(nrows=3) raw
raw
gvkey | date | PRisk | NPRisk | Risk | PSentiment | NPSentiment | Sentiment | PRiskT_economic | PRiskT_environment | ... | Covid_Risk | SARS_Exposure | H1N1_Exposure | Zika_Exposure | Ebola_Exposure | Brexit_Exposure | Brexit_Neg_Sentiment | Brexit_Pos_Sentiment | Brexit_Net_Sentiment | Brexit_Risk | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1004 | 2002q1 | 359.55072 | 2928.6014 | 168.98235 | 997.86415 | 5550.5807 | 469.39542 | 9001.563 | 6331.43 | ... | 0 | 0 | 0 | 0 | 0 | NaN | NaN | NaN | NaN | NaN |
1 | 1004 | 2002q2 | 0.00000 | 0.0000 | 0.00000 | 1594.73210 | -5656.6074 | 544.82417 | 0.000 | 0.00 | ... | 0 | 0 | 0 | 0 | 0 | NaN | NaN | NaN | NaN | NaN |
2 rows × 36 columns
process_raw_data
process_raw_data (df:pandas.core.frame.DataFrame=None, gvkey_permno_link:Union[bool,pandas.core.frame.DataFram e]=True)
Converts gvkey
to string and applies pandasmore.setup_panel
. Adds permno
if gvkey_permno_link
is not False.
Type | Default | Details | |
---|---|---|---|
df | pd.DataFrame | None | Raw data |
gvkey_permno_link | bool | pd.DataFrame | True | Whether to download permno or not. If DataFrame, must contain permno , gvkey , and Qdate |
Returns | pd.DataFrame |
= process_raw_data(raw, gvkey_permno_link=False) df
df
date | dtdate | PRisk | NPRisk | Risk | PSentiment | NPSentiment | Sentiment | PRiskT_economic | PRiskT_environment | ... | Covid_Risk | SARS_Exposure | H1N1_Exposure | Zika_Exposure | Ebola_Exposure | Brexit_Exposure | Brexit_Neg_Sentiment | Brexit_Pos_Sentiment | Brexit_Net_Sentiment | Brexit_Risk | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gvkey | Qdate | |||||||||||||||||||||
001004 | 2002Q1 | 2002-03-31 | 2002-03-31 | 359.55072 | 2928.6014 | 168.98235 | 997.86415 | 5550.5807 | 469.39542 | 9001.563 | 6331.43 | ... | 0 | 0 | 0 | 0 | 0 | NaN | NaN | NaN | NaN | NaN |
2002Q2 | 2002-06-30 | 2002-06-30 | 0.00000 | 0.0000 | 0.00000 | 1594.73210 | -5656.6074 | 544.82417 | 0.000 | 0.00 | ... | 0 | 0 | 0 | 0 | 0 | NaN | NaN | NaN | NaN | NaN |
2 rows × 36 columns