The questions looks very easy but I did not find a suitable intuitive answer. Suppose I have a df.
df = pd.DataFrame({"A": [-1,2,3], "B": [-2, 8, 1], "C": [-5, -6, 7]})
I want to create a column 'D' which gives the max of absolute values between 'A' and 'B'. In short what I am expecting is kind of the following form.
df["D"] = (df["A"].abs(), df["B"].abs()).max()
or
df["D"] = max(df["A"].abs(), df["B"].abs())
or
df["D"] = max(abs(df["A"]), abs(df["B"])
Obviously, none of them works because the syntax is taken from SAS and Excel. Help please.