Python Forum
Loop pandas data frame by position ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loop pandas data frame by position ?
#1
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.
Reply
#2
You can use iloc selector, e.g.

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Grouping in pandas/multi-index data frame Aleqsie 3 607 Jan-06-2024, 03:55 PM
Last Post: deanhystad
  Filtering Data Frame, with another value NewBiee 9 1,331 Aug-21-2023, 10:53 AM
Last Post: NewBiee
Smile How to further boost the data read write speed using pandas tjk9501 1 1,231 Nov-14-2022, 01:46 PM
Last Post: jefsummers
Thumbs Up can't access data from URL in pandas/jupyter notebook aaanoushka 1 1,831 Feb-13-2022, 01:19 PM
Last Post: jefsummers
Question Sorting data with pandas TheZaind 4 2,297 Nov-22-2021, 07:33 PM
Last Post: aserian
  Exporting data frame to excel dyerlee91 0 1,606 Oct-05-2021, 11:34 AM
Last Post: dyerlee91
  Pandas Data frame column condition check based on length of the value aditi06 1 2,655 Jul-28-2021, 11:08 AM
Last Post: jefsummers
  Adding a new column to a Panda Data Frame rsherry8 2 2,083 Jun-06-2021, 06:49 PM
Last Post: jefsummers
  [Pandas] Write data to Excel with dot decimals manonB 1 5,775 May-05-2021, 05:28 PM
Last Post: ibreeden
  pandas.to_datetime: Combine data from 2 columns ju21878436312 1 2,421 Feb-20-2021, 08:25 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020