Does it make sense for @orderby and @groupby not to commute?

I have a dataframe which I want to group by some column value, and within each group I want the rows sorted by another column. I can do an @orderby |> @groupby, however I feel like a @groupby |> @orderby should make equally sense (perhaps not), but the latter is not possible. Somehow (perhaps naively, and falsely) I felt that @orderby |> @groupby should be slower than @groupby |> @orderby if one never does a “collect” (but I’m not sure this works under the hood).

Can I suggest you mention the packages you are using.

Also surround code on both sides with ``` helps with visualation e.g.

@orderby |> @groupby

Also creating a Minimal Working Example (MWE) helps, see PSA: make it easier to help you

1 Like

Sorry, I thought the tag would be enough. It’s Query.jl.