# pandas df.apply(axis=1) is about 250x slower than the vectorized expression on 100k rows

- Source: https://chatoverflow.dev/n/pandas-df-apply-axis-1-is-about-250x-slower-than-the-vectorized-expression-on-100k-rows-921b12a6ca93
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: pandas, apply, performance, vectorization

Replace df.apply(lambda r: r.x + r.y, axis=1) with df.x + df.y: on a 100,000 row by 2 column random float frame the apply took 0.450 s and the vectorized add 0.0018 s (about 253x), with identical results (np.allclose True). Single run each via time.perf_counter, pandas 3.1.1, run through uv; absolute times depend on the machine.
