2

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)
Sheldore
  • 37,862
  • 7
  • 57
  • 71
J.J.
  • 75
  • 8
  • I found the solution, the data is heavily populated with dates so the best way would be to skip all datetime datal. – J.J. Dec 20 '18 at 19:09

1 Answers1

5

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.

Sheldore
  • 37,862
  • 7
  • 57
  • 71
  • how would I check if there is datetime, Ive tried isinstance(column, datetime.datetime) and type(column) the datetime type is datetime64 – J.J. Dec 20 '18 at 19:21
  • 1
    gotcha something new everyday – J.J. Dec 21 '18 at 18:25