3

Recently I have found this question:

How to perform element-wise Boolean operations on NumPy arrays

which is marked as a dupe of this:

Logical operators for Boolean indexing in Pandas

The answer to the second question indeed answers the first one, but the question itself is not duplicate of the second one, as it does not at all mention NumPy. Someone looking for a NumPy solution is unlikely to open a Pandas question.

Should I vote to reopen?

7
  • You think that when the person using Numpy finds the closed question they won't follow the link to the Pandas question?
    – BSMP
    Sep 9, 2021 at 8:13
  • @BSMP, I wouldn't normally, yes.
    – zabop
    Sep 9, 2021 at 8:15
  • @yivi, yes, the first one.
    – zabop
    Sep 9, 2021 at 8:16
  • @JeanneDark, yes. Based on those, I'm voting to reopen.
    – zabop
    Sep 9, 2021 at 8:22
  • 7
    "as it does not at all mention Numpy" And it should not have to. Masking via boolean operators is used widely in Python, it is not exclusive to either numpy or pandas. Collecting different ways of asking the same thing – or-masking in numpy, or-masking in pandas, or-masking in … – is a key point of why duplicate closures are good. Sep 9, 2021 at 8:38
  • 2
    In essence duplicate closure is meant to lead people to the most relevant answer. Mission accomplished apparently if the meta question body is to be believed. You might not normally look at pandas question, but I do hope that a duplicate link would persuade you to take a gander anyway. If not, well then you have two problems.
    – Gimby
    Sep 9, 2021 at 12:20
  • A related Q&A from RPG.SE (which may differ from how SO handles duplicates): If an answer to question A can be found in question B, should we close A as duplicate of B?
    – V2Blast StaffMod
    Sep 9, 2021 at 16:02

1 Answer 1

6

Do not re-open. This is exactly how duplicate closure is meant to work.


The key difference between the questions boils down to this:

it does not at all mention NumPy

While this is relevant for describing a problem, it is not actually relevant for the problem itself. Both the NumPy and Pandas (and many other scientific Python) cases are actually about a more fundamental task/mechanism.

Not knowing this is perfectly fine for people seeking answers – after all, they would have to already know the solution otherwise. So it is good to have the different specific questions.

However, there is little point duplicating the solutions. In fact, calling attention to the underlying task/mechanism is part of a proper answer. So it is good to have few general answers.

Duplicate closure does exactly that: It preserves the various different ways of asking the same thing while directing attention to the same fundamental answers.


That said, duplicate closure is always parts subjective and parts pragmatic. It is normal that duplicates are not perfect matches when one is just looking at them literal enough. Many questions are written with practical considerations in mind, not generalisation as a duplicate target.

Instead of re-opening duplicates due to small differences, consider to edit duplicate targets to smooth out or remove the differences. For example, a simple solution is often to slightly broaden the scope of the duplicate target:

Logical operators for Boolean indexing in Pandas, NumPy, and similar

Changing a known duplicate target to cover a broader scope while leaving its practical example untouched is often doable with reasonable effort. It leaves its current answers valid while signalling that they apply to other related cases as well.

1
  • 2
    Or just change "Pandas" to "Python"? That way you don't have to list everything that uses Python as its underlying language? Sep 9, 2021 at 13:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .