We can use the following to iterate the rows of a data frame.
for index, row in df.iterrows():
What if I want to start with a different row index? (not from the first line)?
Try using itertools.islice
itertools.islice
from itertools import islice for index, row in islice(df.iterrows(), 1, None):
I know this has an answer, but why not just do:
for i, r in df.iloc[1:].iterrows():
Of course:
for i,(index,row) in enumerate(df.iterrows()): if i == 0: continue # skip first row
Or something like:
for i,(index,row) in enumerate(df.iterrows()): if i < 5: continue # skip first 5 rows