7

I just failed an audit for the following question: Use polars when-then-otherwise on multiple output columns at once. The correct response was "Looks OK," but I flagged as a duplicate because one comment linked to How can I use when, then and otherwise with multiple conditions in polars?, which seems to be asking something similar. Both seem to be about using polars when-then-otherwise to set multiple columns simultaneously.

In addition to the similarities in the questions themselves, I noticed that the top answer for the first question:

cols = ['value', 'value_other', 'value_other2']

(df.with_columns(
    pl.when(pl.col('value').is_null() & (pl.col('quantity') == 0))
    .then(0)
    .otherwise(pl.col(cols))
    .name.keep()
))

Was very similar to the accepted answer for the second question:

df.with_columns(
   pl.when(pl.col("A").is_in(["foo", "spam"]))
     .then(pl.lit("XX"))
     .otherwise(pl.col("L", "G"))
     .name.keep()
)

Was flagging the correct choice, or should I have marked it as "Looks OK"?

17
  • 3
    You only have to ask yourself one question, does the answer to the question, answer the other question. How the question is worded doesn’t make a duplicate it’s entirely about the answer(s) Commented Aug 26 at 5:49
  • 8
    The polars tag and similar are basically regex lite. You have people applying structured curation standards, and you have people hailing the uniqueness of every butterfly wing. It’s not useful to worry about what is correct because there isn’t just one "correct". It doesn’t help that most questions are written about butterfly wings, not about well structured actions. Commented Aug 26 at 6:40
  • 6
    Audits don't really work for duplicates, since they can be on-topic and well-asked, so if no-one notices that a question is a duplicate it can remain open and be upvoted (thus be an audit for a good question). Similarly, if it's closed as a duplicate but otherwise is a good on-topic question, anyone without knowledge on common duplicates for that tag can think it's a good question and fail the audit.
    – Erik A
    Commented Aug 26 at 14:10
  • 1
    It's hard to say anything definitive about it, whatever is said here you are going to see plenty of examples of exactly the opposite happening. This is also influenced a lot by the tags, if it would be a Java question there'd be far less arguments about whether something is a duplicate or not, it's usually pretty cut and dry. When it comes to things like regex or SQL (not programming but programming-aside), it's usually a little more vague as the devil is usually in the details. So are you interested in what the right choice is, or in how you can prevent an audit failure?
    – Gimby
    Commented Aug 27 at 12:50
  • 6
    @SecurityHound I strongly disagree with that statement. I've seen questions that were totally dissimilar closed as duplicate just because the same answer worked for both. Commented Aug 27 at 15:18
  • 2
    @MarkRansom—If both questions were answered correctly, it sounds like they were duplicates. Do you disagree with that conclusion? When you flag a question as a duplicate, a comment is automatically generated, asking if the answer to the existing question answers the question the question that was flagged. Commented Aug 27 at 16:38
  • @SecurityHound the last example I saw of this was quite some time ago, so I don't have any examples to point to. If I recall correctly the newer question was closed so fast it didn't have time to collect its own answers. As for the automatic comment, what happens if the answer is no? You're relying on enough people noticing and voting to reopen. Commented Aug 27 at 18:43
  • @MarkRansom - The community is often a better decider if a question is a duplicate of another question. What is the speed of the closure important? Commented Aug 27 at 19:19
  • @SecurityHound the community will mostly ignore a question with the dreaded [closed] designation. You won't get enough eyeballs to reopen, even if the question is deserving. Commented Aug 27 at 19:48
  • 5
    I mean... that's very much false. we have an entire review queue dedicated to just that. Feel free to participate in it.
    – Kevin B
    Commented Aug 27 at 19:56
  • 2
    @MarkRansom - You are mistaken. There is a queue especially for closed questions, even if that didn’t exist, your not answering the question I proposed to you or how it relates to properly closing a question as a duplicate Commented Aug 27 at 21:46
  • @SecurityHound just passing and thought I'd comment FWIW. the English sentence, and the concept, "the question is a duplicate" is pretty straightforward. the only two important words are "question" and "duplicate". (And as an aside, recall, apart from anything else, the fundamental elephant in room base flaw of stackoverflow - that 95% of answers become utterly incorrect after 5-7 years, because software. [sure, the tiny handful of (commercially totally irrelevant) questions about "pure comp sci" stay correct for say 10-20 years])
    – Fattie
    Commented Aug 28 at 14:33
  • 1
    @Fattie - It sounds like a UI conflict between how the community determines if a question is duplicated and the understanding of users unfamiliar with reality. However, how duplicates have worked has not changed in the 15 years I have been a user. I'm afraid I have to disagree that questions become incorrect after 5-7 years; if anything, new questions are formed as technology advances and new questions are formed. Commented Aug 28 at 15:21
  • 1
    @Fattie Ok, sure, that is English grammar. BUT... it's OK if slightly different posts'/questions' terminologies vary and get pointed to the same existing answer/solution that solves it. What we don't want or need are duplicate answers across different posts that are difficult or impossible to track down because the post's author's choice of words as they often might not know what correct words to use to describe their problem. In other words, it's preferable that questions should funnel towards the common collection of answers.
    – Drew Reese
    Commented Aug 28 at 20:01
  • 1
    Well if we're venting complaints, what has always rubbed me the wrong way is that duplicate closure is based on an answer or multiple answers being the answer to both questions, but the duplicate closure only links on question level. If there are 50 answers in the source question, have fun finding the one that actually answers your question. I tend to post a comment with a link to the actual answer I meant when casting the dupe close vote if this is the case. It's just not right, but the way the site is now is how it is going to stay until AI takes over.
    – Gimby
    Commented Aug 29 at 12:18

0

You must log in to answer this question.