Assuming you are using pandas dataframes
you can use iterrows
In [3]: for index, row in df.iterrows():
...: print('Index is: {}'.format(index))
...: print('ID is: {}; Name is: {}'.format(row['id'], row['name']))
...:
Index is: 0
ID is: 1; Name is: abc
Index is: 1
ID is: 1; Name is: vbs
Index is: 2
ID is: 2; Name is: askj
Iterrows iterates over an index, a tuple of strings. The line here is Series .
In [4]: type(row)
Out[4]: pandas.core.series.Series
source
share