I have the code below that does not work as I want but the mean is clear I guess. In pandas normally we can labeling with df["Label] = df["Column1"] > df["Column2"]
like this. However, when I try labeling with ternary as below, it does not work as I expected. Is there any way to do this with ease?
df["Label"] = "1" if df["Column1"] > df["Column2"] else "2"