J.J.
J.J.

Reputation: 73

Start loop at second column

I am looping through columns but keep getting an error on the first column because it seems to be datetime. Is there a way for me to start a for loop at the second column. This is using Quantopian Fundamental data

for column in Fundamentals.columns:  
    #print(column)  
    start=1+start  
    next = str(column)   

    Prev=Previous(inputs=[column],window_length=window_length)
    Curr=column.latest

    diff=Prev-Curr

    if(diff>0):
        pipe.add(column.latest,next)  

        if start>10:  
            break  
        #print('{}:{},').format(next,column)

Upvotes: 2

Views: 1248

Answers (1)

Sheldore
Sheldore

Reputation: 39072

Since you are already looping over the columns, you can simply use indexing [1:] as

for column in Fundamentals.columns[1:]:  

where you skip the first column and start from the second.

Upvotes: 5

Related Questions