Skip to main content
Active reading [<https://www.youtube.com/watch?v=1Dax90QyXgI&t=17m54s> <https://www.youtube.com/watch?v=1Dax90QyXgI&t=19m05s> <https://en.wikipedia.org/wiki/Pandas_%28software%29>].
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

In short

  • Use vectorization if possible
  • If an operation can't be vectorized - use list comprehensions
  • If you need a single object representing the entire row - use itertuples
  • If the above is too slow - try swifter.applyswifter.apply
  • If it's still too slow - try Cythona Cython routine

Benchmark

Benchmark Benchmark of iteration over rows in a pandas DataFrameBenchmark of iteration over rows in a Pandas DataFrame

In short

  • Use vectorization if possible
  • If operation can't be vectorized - use list comprehensions
  • If you need a single object representing entire row - use itertuples
  • If the above is too slow - try swifter.apply
  • If it's still too slow - try Cython routine

Benchmark Benchmark of iteration over rows in a pandas DataFrame

In short

  • Use vectorization if possible
  • If an operation can't be vectorized - use list comprehensions
  • If you need a single object representing the entire row - use itertuples
  • If the above is too slow - try swifter.apply
  • If it's still too slow - try a Cython routine

Benchmark

Benchmark of iteration over rows in a Pandas DataFrame

deleted 65 characters in body
Source Link
Jean-François Fabre
  • 140.8k
  • 24
  • 179
  • 246

In short

  • Use vectorization if possible
  • If operation can't be vectorized - use list comprehensions
  • If you need a single object representing entire row - use itertuples
  • If the above is too slow - try swifter.apply
  • If it's still too slow - try Cython routine

Details in this video

Benchmark Benchmark of iteration over rows in a pandas DataFrame

In short

  • Use vectorization if possible
  • If operation can't be vectorized - use list comprehensions
  • If you need a single object representing entire row - use itertuples
  • If the above is too slow - try swifter.apply
  • If it's still too slow - try Cython routine

Details in this video

Benchmark Benchmark of iteration over rows in a pandas DataFrame

In short

  • Use vectorization if possible
  • If operation can't be vectorized - use list comprehensions
  • If you need a single object representing entire row - use itertuples
  • If the above is too slow - try swifter.apply
  • If it's still too slow - try Cython routine

Benchmark Benchmark of iteration over rows in a pandas DataFrame

Source Link
artoby
  • 2k
  • 17
  • 13

In short

  • Use vectorization if possible
  • If operation can't be vectorized - use list comprehensions
  • If you need a single object representing entire row - use itertuples
  • If the above is too slow - try swifter.apply
  • If it's still too slow - try Cython routine

Details in this video

Benchmark Benchmark of iteration over rows in a pandas DataFrame