[英]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. 有没有办法让我在第二列开始for循环。 This is using Quantopian Fundamental data 这是使用Quantopian基本数据
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)
Since you are already looping over the columns, you can simply use indexing [1:]
as 由于您已经遍历列,因此您可以简单地使用索引[1:]
作为
for column in Fundamentals.columns[1:]:
where you skip the first column and start from the second. 您跳过第一列并从第二列开始的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.