Say, I have a Pandas DataFrame with 3 columns and rows 0,1,2 ... 1000. Then, suppose I extract a DataFrame from this such that it has randomly selected rows 1,5,9... 999.
Now, how can I iterate over the rows of this new DataFrame with alternating odd rows? A for-loop iterating from 0 through 1000 would return KeyError at inappropriate indices in the new DataFrame, for example. Is there a way to get a list of the rows that are retained in the new DateFrame?
P.S. I lack experience with this website, so apologies if my question could've been formatted better. Thank you.