在python中将<class'pandas.core.frame.DataFrame'>作为参数发送时,为什么在方法中接收多个值

2024-05-19 22:11:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在实现一个多线程的概念,它将一个块<class 'pandas.core.frame.DataFrame'>划分成若干块。当我把它作为参数发送到目标函数时,我得到的错误是

TypeError: thread_chunking() takes 2 positional arguments but 3 were given

我尝试在target方法中接收as*args,但它是以tuple的形式给出的,没有只包含标题的内容

我的代码在下面

thread_chunk=pandas.read_sql("some sql here")
....
thread_name= threading.Thread(target=self.thread_chunking,args=thread_chunk[0:100]))

那么如何在python的线程中向目标函数传递


Tags: 函数core概念target目标dataframepandassql