-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deduplication reporting update #187
base: master
Are you sure you want to change the base?
Conversation
is_flag=True, | ||
default=False, | ||
help="Add column to the output pairs with the number of duplicates. " | ||
"Comparible with sklearn and scipy backends only. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CompaTible
default=False, | ||
help="Add column to the output pairs with the number of duplicates. " | ||
"Comparible with sklearn and scipy backends only. " | ||
"Is not counted by default. [output dedup pairs format option]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "Off by default"?
@@ -388,6 +398,11 @@ def dedup_py( | |||
send_header_to_dedup = send_header_to in ["both", "dedup"] | |||
send_header_to_dup = send_header_to in ["both", "dups"] | |||
|
|||
count_dups = kwargs.get("count_dups", False) | |||
if backend=="cython" and count_dups: | |||
logger.warning("Not countin number of duplicates with Cython backend.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
countinG
Can you add tests for this feature? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
@@ -221,8 +279,16 @@ def _dedup_chunk( | |||
df = df.reset_index() # Remove the index temporarily | |||
|
|||
# Set up columns to store the dedup info: | |||
df["clusterid"] = np.nan | |||
df["duplicate"] = False | |||
df.loc[:, "clusterid"] = np.nan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agalitsyna , tests fail at this line with an error message "ValueError: cannot set a frame with no defined index and a scalar".
Googling suggests that such an error arises when one tried to index an empty frame: https://stackoverflow.com/questions/48306694/valueerror-cannot-set-a-frame-with-no-defined-index-and-a-value-that-cannot-be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @agalitsyna
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe df.assign? What's your favorite way of filling in columns in dataframe?
https://stackoverflow.com/questions/34811971/how-do-i-fill-a-column-with-one-value-in-pandas
Added
--count-dups
reporting mode for scipy and scikit-learn backends that report the number of duplicates (a little bit unfair, though, as the parent is counted there as well - it seems to make most of sense to report).