Python Forum
How define iteration interval increment
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How define iteration interval increment
#6
We can specify that sort of thing with a range(), but I didn't see anything equivalent in iterrows. I generally avoid using range to iterate over indexes, preferring to iterate directly. You could do it with a range like this:

for row_index in range(0, len(data), 3):
    row = df.ix[row_index]
    print(row)
Although I think islice from the itertools built-in package might work better:

for index, row in itertools.islice(data.iterrows(), 0, len(d), 3):
    print(row)
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: How define iteration interval increment - by ichabod801 - Jun-01-2019, 01:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Mapping a value to an interval JazonKuer 12 2,035 Mar-17-2023, 07:59 PM
Last Post: Gribouillis
  help to increment a third list hermine 7 1,371 Nov-29-2022, 04:19 PM
Last Post: perfringo
  mysql id auto increment not working tantony 10 2,468 Oct-18-2022, 11:43 PM
Last Post: Pedroski55
  Confidence interval after doing penalised cox regression HatemAli 0 1,152 Feb-23-2022, 11:02 PM
Last Post: HatemAli
  Character Increment AnokhiRaaz 1 2,516 Apr-22-2021, 04:29 AM
Last Post: buran
  Increment text files output and limit contains Kaminsky 1 3,225 Jan-30-2021, 06:58 PM
Last Post: bowlofred
  Complex X Tick Interval JoeDainton123 0 1,483 Oct-05-2020, 07:27 PM
Last Post: JoeDainton123
  Increment formula Kristenl2784 4 2,909 Jul-20-2020, 10:14 PM
Last Post: Kristenl2784
  [openpyxl] Increment cells being pasted into Template Kristenl2784 4 3,600 Jul-16-2020, 10:00 PM
Last Post: Kristenl2784
  Updating a matrix in a time interval inside a for loop vp1989 4 2,924 May-17-2020, 07:15 PM
Last Post: vp1989

Forum Jump:

User Panel Messages

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