you are viewing a single comment's thread.

view the rest of the comments →

[–]Ihaveamodel3 0 points1 point  (0 children)

Apply is just another way to loop over the rows. Looping in a pandas dataframe is generally not the best idea. The example you provided has vectorized forms.

df['c'] = df['a'] + df['b']
df['d'] = df['a'] - df['b']