Start loop at second column

1k views Asked by At

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)
1

There are 1 answers

2
Sheldore On BEST ANSWER

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.