我试图在数据框的第一列和其他列之间计算滚动回归的R平方值(第一列和第二列,第一列和第三列等)。但是当我尝试使用多线程时,它一直告诉我错误:
请查看以下链接中的图片,该图片展示了数据(df)的概要信息:
TypeError: ParallelRegression() argument after * must be an iterable, not int"。
我想知道该怎么解决?非常感谢!
import threading
totalThreads=3 #three different colors
def ParallelRegression(threadnum):
for i in range(threadnum):
res[:,i]=sm.OLS(df.iloc[:,0], df.iloc[:,i+1]).fit().rsquared
threads=[]
for threadnum in range(totalThreads):
t=threading.Thread(target=ParallelRegression,args=(threadnum))
threads.append(t)
t.start()
for threadnum in range(totalThreads):
threads[threadnum].join()
请查看以下链接中的图片,该图片展示了数据(df)的概要信息:
args=(threadnum,)
- Kevin