Python Pandas : iterrows and itertuples

Preprocessing data by looping through dataframe

Laxman Singh
4 min readSep 26, 2021

Pandas is one of the most used libraries in pre processing the data. Why? Pandas is simple, easy and filled with lots of utilities to tweak data. Pre processing always involves from loading the data, analyzing it and transforming it. This library has all the qualities to use data for preprocessing as it contains power of numpy and matplotlib. It is fast in executing, capable of doing array calculation and visualize your data in very simple commands. You can analyze whole dataset, each field, aggregate the data and summarize the columns in user defined manner too. For basic of understanding, you can read blog and another blog for groupby.

This blog will be towards understanding different manipulation tricks like iterating through columns and visualizing the data.

Dataframe Iterations

As we all know, pandas load the data in the form of dataframe. Till now, we have done commands to summarize data and aggregate columns using group by. Now, we should be able to iterate through columns and find the required things based on our requirements. The main motive here is to iterate through columns and get the data from the columns to manipulate further as we do in any other programming. Let us learn how we can iterate…

--

--

Laxman Singh
Laxman Singh

Written by Laxman Singh

Machine Learning Engineer | Data Science | MTECH NUS, Singapore