Skip to content

BUG/CLN?: get_duplicates in _build_names_mapper #52229

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

Closed
twoertwein opened this issue Mar 26, 2023 · 5 comments · Fixed by #57789
Closed

BUG/CLN?: get_duplicates in _build_names_mapper #52229

twoertwein opened this issue Mar 26, 2023 · 5 comments · Fixed by #57789
Assignees
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode

Comments

@twoertwein
Copy link
Member

This function looks like it doesn't do what it is intended to do:

def get_duplicates(names):

Based on the implementation it can be replaced by just set(names) but that doesn't match with the intention of the name.

@samjeffrees
Copy link

samjeffrees commented Mar 28, 2023

Hi @twoertwein,

I've just had a look and based on the docstring in _build_names_mapper() and it looks like this isn't working as intended. This can be fixed by changing get_duplicates to something like the following:

def get_duplicates(names):
    seen: set = set()
    duplicate: set = set()
    for name in names:
        if name not in seen:
            seen.add(name)
        else:
            duplicate.add(name)
    return duplicate

Is it okay if I pick this up?

I'm new here so pls forgive the ignorance :-)

EDIT: I'm going to take this, better to seek forgiveness etc.

@samjeffrees
Copy link

take

@twoertwein
Copy link
Member Author

This can be fixed by changing get_duplicates to something like the following

Sorry, I can't help you with that - I'm not familair with that code, just stumbled into it accidentaly.

@topper-123 topper-123 added Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Mar 28, 2023
@topper-123
Copy link
Contributor

This does look weird. @samjeffrees, could you try your solution and and see if it breaks some tests?

@tqa236
Copy link
Contributor

tqa236 commented Mar 9, 2024

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
4 participants