How can I transform the "y" values so that each y_i is replaced by y_i - Max[#y], where Max[#y] is the maximum of the "y" column.
I would like to verify whether this means that I need to store in some variable the value of Max[#x], or this rather can be done in one step with a pure function.
My suspicion is that this not very effective, because this way ds[Max, "y"] seems to be evaluated again and again, as this does suggest so (using nn as a counter):
nn = 0;
ds[All, <|"x" -> #x, "y" -> #y - (nn++; ds[Max, "y"])|> &];
nn
(* Out: 5 *)
In cases like this there is a choice between code elegance or computation efficiency. To paraphrase Hamlet: To save or not to save? There is no fixed answer.