iterating row by row through a pandas dataframe

PythonPandas

Python Problem Overview


I'm looking to iterate row by row through a pandas DataFrame. The way I'm doing it so far is as follows:

for i in df.index:
    do_something(df.ix[i])

Is there a more performant and/or more idiomatic way to do this? I know about apply, but sometimes it's more convenient to use a for loop.

Python Solutions


Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpeoplesparkresidentView Question on Stackoverflow