Iteration in Pandas is an anti-pattern and is something you should only do when you have exhausted every other option. You should not use any function with "iter" in its name for more than a few thousand rows or you will have to get used to a lot of waiting.

Do you want to compute something? In that case, search for methods in this order:
    1. Vectorization
    2. Cython routines
    3. List Comprehensions
    4. DataFrame.apply()
    5. DataFrame.itertuples() and DataFrame.iteritems()
    6. DataFrame.iterrows()

iterrows and itertuples should be used in very rare circumstances, such as generating row objects/nametuples for sequential processing, which is really the only thing these functions are useful for.

A good number of basic operations and computations are "vectorized" by pandas (either through NumPy, or through Cythonized functions). This includes arithmetic, comparisons, (most) reductions, reshaping, joins, and groupby operations.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence