I failed this audit, which is kind of ridiculous. I voted to close the question, because it:

  1. really belongs on Programmers or Code Review, not Stack Overflow;
  2. is broad;
  3. is multi-part;
  4. doesn't describe a specific problem encountered by the user with specific code.

Problematic parts of the question:

  • The title:

    What is pythonic way to do dt[,y:=myfun(x),by=list(a,b,c)] in R?

  • The first question, which asks for opinion-based code review:

    Although the logic is quite clear, I am not 100% happy with it. Is there any better approach?

  • A vague tool recommendation/evaluation request, reflecting minimal effort or knowledge:

    I am not very familiar with pandas. Does it help in such case?

  • And a "side question" which really belongs on Programmers or Code Review:

    Side question: is there a category that my problem belongs to? aggregation? partition? window? This pattern happens so frequently in data analysis, there must be an existing name for it.

The OP provided code in both R and Python, true, but doesn't have a problem with that code; he just wanted a review and analysis of it. This should be a straightforward close, for any number of reasons.

  • Voting by its nature means that it is soliciting an opinion, so I guess it is crazy to assume that all well meaning, competent reviewers will always vote in the same way. I don't really sweat with reviews, as hopefully there is some kind of comparison to a normal distribution curve in effect when it comes to failures.
    – StuartLC
    Jan 3, 2014 at 13:19
  • 2
    Just because a question could work on another site doesn't automatically make it off-topic on the site it is on. Many sites, especially the programming and technology sites, have overlapping scopes, so questions could be on-topic in multiple places. Jan 3, 2014 at 13:25
  • Not sure what all the down votes are for. Voting and voting to close are different things. This question was not even a close call. @psubsee2003: the point here isn't that the question could was on-topic for multiple sites; it's that the question was decidedly off-topic for SO.
    – elixenide
    Jan 3, 2014 at 14:55
  • @EdCottrell I think the downvotes on this post and the upvotes on Bill's answer are saying that the community does not agree with that assessment Jan 3, 2014 at 15:21
  • @psubsee2003 I agree that's what they mean, but I don't get it. Bill's answer doesn't really explain a reason to keep the question open; he just says it's a good question (and makes a couple of incorrect statements about the question).
    – elixenide
    Jan 3, 2014 at 15:43
  • 1
    @EdCottrell but again, we're back to how the voting is going. Your opinion is that it is a bad question. A number of users agree with your position. But more users agree that it is a good question. Forgetting about the audit, you are free to vote to close the post as you see fit, and if 4 other users agree with you, it will get closed. Jan 3, 2014 at 15:46
  • @psubsee2003 I see your point, but the issue is whether it's a good audit question. Right now, if the voting is any indicator, the answer is no.
    – elixenide
    Jan 3, 2014 at 15:49
  • 1
    @EdCottrell then go vote to close the question or downvote it and it will never be used as an audit again. Jan 3, 2014 at 15:51

3 Answers 3


The purpose of the audits is to detect robo-reviewers, not to enforce group-think on voting behavior. Ideally, no one would fail an audit from a good-faith exercise in actual thought, even if the reviewer reaches an unconventional conclusion. After all, in live operations, we require multiple close votes for a reason, and we don't punish the minority.

However, as flogged to death and back again three times, the audit system is inescapably imperfect. The heuristics it uses to select candidates are guaranteed to produce this result from time to time.

The team's response, over and over, has been to reassure reviewers-in-good-faith that rare audit failures are nothing to worry about, and to decline all requests to soften the yelling language or offer an 'appeal' button.


I think this is a bad question to use for review, but I don't think it necessarily needs to be closed.

really belongs on Programmers or Code Review, not Stack Overflow;

There's no reason to move it if it's on-topic on Stack Overflow just because it might also be on-topic on another site. It also already got a good answer on Stack Overflow, so there's no need to move it now.

is broad;

No, it's ultra-specific. It gives a line of code in R, an attempted solution in Python, and asks how to do that better in Python.

is multi-part;

Ok, but is that a reason to close a question?

doesn't describe a specific problem encountered by the user with specific code.

I think it's pretty clear from context that the OP is looking for a one-line solution in Python like the one-liner in R. The author of the question isn't asking for a review of their Python code. I think it's there to show that they did make an effort, but fell short of the goal set by the R code.

  • You must have been looking at my screen, I was typing almost the same thing Jan 3, 2014 at 13:22
  • 2
    @psubsee2003 That's one of the new, top secret moderator tools that they just rolled out! ;) Jan 3, 2014 at 13:26
  • 1
    Wow, you are going to get accused of a lot of plagiarism that way :-) Jan 3, 2014 at 13:26
  • "I think it's pretty clear from context that the OP is looking for a one-line solution in Python like the one-liner in R." Actually, quite the opposite: OP was asking for the most Python-esque way to rewrite the R code. Regardless, it doesn't demonstrate a specific programming problem encountered by the user. Instead, it presented working code and asked for reviews/commentary/improvement.
    – elixenide
    Jan 3, 2014 at 14:59
  • @EdCottrell "Suppose I have a data frame which have column x, a, b, c And I would like to aggregate over a, b, c to get a value y from a list of x via a function myfun, then duplicate the value for all rows within each window/partition." Jan 3, 2014 at 15:27
  • @BilltheLizard I saw that language, but that's not a problem or error OP's encountering. OP says he knows how to do it already; he just wants comments on his code or suggestions for a more Python-like way to do it. That puts it squarely on-topic for Programmers or Code Review, but off-topic for SO.
    – elixenide
    Jan 3, 2014 at 15:45
  • 2
    By the way, you really made my point here: "I think this is a bad question to use for review, but I don't think it necessarily needs to be closed." Apparently, there's at least some disagreement as to whether it should be closed (mostly downvotes for my question, but significant upvotes as well), so the question shouldn't have been used as an audit.
    – elixenide
    Jan 3, 2014 at 15:48

From Which computer science / programming Stack Exchange do I post in?:

That's the most clear cut, on Code Review you share working code for peer review. If your code is not working, then you should ask on Stack Overflow. So it is the right place you if you have a question about best practices, security issues, performance improvements, refactoring a piece of working code, etc.

Since the code in this review question is working, either

  • the OP's close action is valid, or
  • this highly upvoted answer is incorrect
  • 3
    The working code is an important part of the condition given here for posting on Code Review, but not the only part. That you're posting the code "for peer review" is also necessary. As Bill already explained, the OP here doesn't really want their existing code reviewed. In this case, it looks to me like the question would still make sense and be a good question even if the poster hadn't included their Python code at all, so clearly the question doesn't belong on CodeReview.
    – Mark Amery
    Jan 3, 2014 at 14:27
  • The fact that the question is on-topic for CodeReview (even if true) doesn't necessarily imply that the question is off-topic for StackOverflow.
    – D.W.
    Jan 4, 2014 at 5:10

You must log in to answer this question.

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