| Reference | Downloads | Github

Confused about indices used in selected rows

I’m using the builder view and dividing an experiment into 3 blocks by using the selected rows function in the looping mechanism. There are 84 trials in the conditions excel sheet.

I put block 1 as selected rows = 0:27
block 2 i enter the selected rows as 28:55
block 3 i enter the selected rows as 56:83

I ran the experiment and I only see 27 trials in each output excel sheet instead of 28 like it should be

What gives!!
It’s probably something really stupid I’m missing here but I can’t figure it out.

Python indexing is not always intuitive. e.g. if we have list like this:

a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]



returns this:

[0, 1, 2]

i.e. the end value of the index is not included in the selected range but the difference between the start and end tells you how many entries will be selected. So I guess you should be selecting:


But I could easily be wrong.

Check here for an explanation:

1 Like

Following up on this, does selected rows take into account the column name (which is usually at the top of the column)? So let’s say I had:
And I want, say, 4 trials with that info. Would I specify for selected rows 0:5 (to include header)? Or 1:5 (excluding header). Or does it take into account the header, so I would specify 0:4?

The first row of actual data is row 0. The header is not considered.

1 Like

thanks for the reply on this ancient thread!!

The tricky thing in Python is often the end value. It might be that you need to ask for rows 0:4, in order to select the four values in rows 0 through 3. I can never remember which way it works, and usually just try it and see.

You’re right–it doesn’t count the ending value so it would be 0:4. I quite like that Python does this now that I’ve gotten used to it.