|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""This helper script creates the classnames variable for lenu.py""" |
|
|
|
|
|
from lenu import URL |
|
import pandas |
|
|
|
|
|
relevant_cols = [ |
|
"LEI", |
|
"Entity.LegalName", |
|
"Entity.LegalForm.EntityLegalFormCode", |
|
"Entity.LegalJurisdiction", |
|
"Entity.EntityCategory", |
|
"Entity.EntityStatus", |
|
"Registration.RegistrationStatus", |
|
] |
|
|
|
|
|
COL_LEI, COL_NAME, COL_ELF, COL_JUR, COL_CAT, COL_ESTATUS, COL_RSTATUS = relevant_cols |
|
|
|
|
|
if __name__ == "__main__": |
|
d = pandas.read_csv( |
|
URL, |
|
compression="zip", |
|
low_memory=True, |
|
dtype=str, |
|
|
|
na_values=[""], |
|
keep_default_na=False, |
|
usecols=relevant_cols, |
|
) |
|
|
|
d_issued = d[(d[COL_ESTATUS] == "ACTIVE") & (d[COL_RSTATUS] == "ISSUED")] |
|
|
|
classnames = { |
|
jur: classes |
|
for jur, classes in d_issued.groupby(COL_JUR)[COL_ELF] |
|
.unique() |
|
.apply(list) |
|
.to_dict() |
|
.items() |
|
if jur |
|
in [ |
|
"AT", |
|
"AU", |
|
"CH", |
|
"CN", |
|
"CZ", |
|
"DE", |
|
"DK", |
|
"EE", |
|
"ES", |
|
"FI", |
|
"GB", |
|
"HU", |
|
"IE", |
|
"JP", |
|
"KY", |
|
"LU", |
|
"NL", |
|
"NO", |
|
"PL", |
|
"SE", |
|
"US-CA", |
|
"US-DE", |
|
"US-NY", |
|
"VG", |
|
"LI", |
|
"ZA", |
|
] |
|
} |
|
|
|
print("Please copy the following snippet into lenu.py:") |
|
print("") |
|
print("classnames = ", classnames) |
|
|