Skip to content

Commit

Permalink
Merge pull request #521 from theosanderson/moreusefulerror
Browse files Browse the repository at this point in the history
More useful error message for duplicate key
  • Loading branch information
theosanderson authored Sep 12, 2023
2 parents 5dc16ea + 5035d49 commit 8dd1ec6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions taxoniumtools/src/taxoniumtools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def read_metadata(metadata_file, columns, key_column):
warnings.filterwarnings("default")
metadata.set_index(key_column, inplace=True)
# convert metadata to dict of rows
if not metadata.index.is_unique:
raise ValueError(
f"Error: The key column '{key_column}' contains non-unique values in the metadata file."
)

metadata_dict = metadata.to_dict("index")
metadata_cols = metadata.columns
Expand Down

1 comment on commit 8dd1ec6

@vercel
Copy link

@vercel vercel bot commented on 8dd1ec6 Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.