Python Forum
How to access previous row using itertuples
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to access previous row using itertuples
#7
both of my examples handle every iteration, not just the first. Run the examples and you will see. The examples differ in how they handle the first iteration.

You can't iterate over all the rows and have the previous row for each iteration. There is no "previous row" for the first iteration. In my first example I handle there not being a previous row by not printing the previous row. In the second example I skip the first row and iterate over the remaining rows. The first row becomes the first "previous row".
Reply


Messages In This Thread
RE: How to access previous row using itertuples - by deanhystad - Feb-05-2022, 05:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] How to access previous row using itertuples newoptionz 1 735 Feb-28-2023, 04:43 PM
Last Post: deanhystad
  proper syntax for itertuples? ilcaa72 1 2,098 Jun-06-2019, 02:41 AM
Last Post: scidam

Forum Jump:

User Panel Messages

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