Python Forum
Loop pandas data frame by position ? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Loop pandas data frame by position ? (/thread-20905.html)



Loop pandas data frame by position ? - Johnse - Sep-05-2019

Hello,

Is there a way to loop a pandas data frame by position ?

The loop is generally this way,

For i, r in a.iterrows():

If I want to start at index 10,
instead of the beginning
how do I do that ?

Hope you know what I mean.


RE: Loop pandas data frame by position ? - scidam - Sep-06-2019

You can use iloc selector, e.g.

for i, r in a.iloc[10:].iterrows():
    pass