Skip to content

Commit

Permalink
show duplicates on non-unique query
Browse files Browse the repository at this point in the history
  • Loading branch information
veni-vidi-vici-dormivi committed Feb 7, 2024
1 parent 1d16512 commit 5ba857c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ __pycache__

.pytest_cache/

# development scripts
devel/*

# C extensions
*.so

Expand Down
5 changes: 4 additions & 1 deletion filefinder/_filefinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@ def find(self, keys=None, *, _allow_empty=False, **keys_kwargs):
len_all = len(fc.df)
len_unique = len(fc.combine_by_key().unique())

msg = "This query leads to non-unique metadata. Please adjust your query."
#msg = "This query leads to non-unique metadata. Please adjust your query."
if len_all != len_unique:
duplicated = fc.df[fc.df.duplicated()]
msg = f"This query leads to non-unique metadata. Please adjust your query.\n Head of duplicates: \n {duplicated.head()}"

raise ValueError(msg)

return fc
Expand Down

0 comments on commit 5ba857c

Please sign in to comment.