Skip to content

Commit

Permalink
Avoid dropping column if synonym_N column only is partially empty
Browse files Browse the repository at this point in the history
  • Loading branch information
zikolach committed Nov 7, 2019
1 parent 3707303 commit 821eb68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyam/iiasa.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def regions(self, include_synonyms=False):
synonyms = df['synonyms'].apply(pd.Series)
synonyms = synonyms.rename(columns=lambda x: 'synonym_' + str(x))
# remove synonym_0 if no synonyms retrieved at all
synonyms = synonyms.dropna(axis=1)
synonyms = synonyms.dropna(axis=1, how='all')
df = pd.concat([df[:], synonyms[:]], axis=1)
df = df.drop(columns=['id', 'synonyms', 'parent', 'hierarchy'])
df = df.rename(columns={'name': 'region'})
Expand Down

0 comments on commit 821eb68

Please sign in to comment.