Skip to content

BUG: Exactly same check multiple times in if statement #42781

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
3 tasks done
debnathshoham opened this issue Jul 28, 2021 · 2 comments · Fixed by #42828
Closed
3 tasks done

BUG: Exactly same check multiple times in if statement #42781

debnathshoham opened this issue Jul 28, 2021 · 2 comments · Fixed by #42828

Comments

@debnathshoham
Copy link
Member

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.

Hi, I stumbled upon this while trying to fix another bug.
Is there a reason for the multiple check below (Lines 3536-3537)?
Should be a quick fix.

def _union(self, other, sort) -> MultiIndex:
other, result_names = self._convert_can_do_setop(other)
if (
any(-1 in code for code in self.codes)
and any(-1 in code for code in self.codes)
or self.has_duplicates
or other.has_duplicates
):

@debnathshoham debnathshoham added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 28, 2021
@jreback
Copy link
Contributor

jreback commented Jul 28, 2021

prob 2nd should be other.codes

@phofl
Copy link
Member

phofl commented Jul 28, 2021

Yes, fast_unique_multiple does Not match nans iirc

@phofl phofl added MultiIndex and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 28, 2021
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants