As far as I know using .apply() in pandas is rather inefficient because it isn't vectorized. I have a bunch of relatively normal operations like addition or multiplication which I want to do differently depending on the content of certain columns.
The central question is what are the advantages and disadvantages of the two below code snippets:
df['col'] = df['col'].apply(lambda x: x/df['col'].max() if x < 1000 else x)
# or
df.loc[df['col']<1000,'col'] = df["col"]/df['col'].max()
I've noticed that the first is slower but I've seen it recommended a lot and I sometimes get slice errors for the second version so was hesitant to use it.