Skip to content

Commit

Permalink
Update database_update.yml
Browse files Browse the repository at this point in the history
Fix issue when industry data is not available.
  • Loading branch information
JerBouma authored Aug 15, 2023
1 parent 9925235 commit 8e5f82c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/database_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ jobs:
ticker_dict[index]['industry'] = np.nan
try:
industry_divison = equities[equities['industry'] == industry]
industry_divison = equities[equities['industry'] == ticker_dict[index]['industry']]
industry_group = industry_divison['industry_group'].mode()[0]
ticker_dict[index]['industry_group'] = industry_group
except KeyError:
ticker_dict[index]['industry_group'] = np.nan
try:
sector_division = equities[(equities['industry_group'] == industry_group) & (equities['industry'] == industry)]
sector_division = equities[(equities['industry_group'] == ticker_dict[index]['industry_group']) & (equities['industry'] == ticker_dict[index]['industry'])]
sector = sector_division['sector'].mode()[0]
ticker_dict[index]['sector'] = sector
Expand All @@ -136,7 +136,7 @@ jobs:
ticker_dict[index]['composite_figi'] = np.nan
ticker_dict[index]['shareclass_figi'] = np.nan
# Create a DataFrame out of the created dictionty
# Create a DataFrame out of the created dictionary
updated_companies = pd.DataFrame.from_dict(ticker_dict, orient='index')
updated_companies.index.name = 'symbol'
Expand Down Expand Up @@ -383,4 +383,4 @@ jobs:
print(f"{index}: {row['error']}")
raise ValueError("There are invalid sector, industry groups and/or industries found. "
"Please check if it adheres to https://www.msci.com/our-solutions/indexes/gics")
"Please check if it adheres to https://www.msci.com/our-solutions/indexes/gics")

0 comments on commit 8e5f82c

Please sign in to comment.