如何解决由于pycaret的设置功能导致文件结束错误
我正在制作 Automl 的对象,我正在调用显示文本小部件的函数初始设置,当提交文本时,它调用 target_submit_handler,后者在内部调用 classification_setup
,后者调用 pycaret 的 setup()
library 但是,当调用 setup 函数时,我收到了文件结尾错误:
from pycaret.classification import *
class AutoMl():
def __init__(self):
self.dataframe=pd.DataFrame()
self.w=None
self.setup=None
def classification_setup(self,data,target):
x=setup(self.dataframe,"Species") //this fucntion is of pycaret library which displays the end of file er
def target_submit_handler(self,text):
# print(self.dataframe,self.target.value) I am geting the correct dataframe and target column name
self.classification_setup(data=self.dataframe,target="Species")
def initial_setup(self,dataframe=None,target=None):
if(dataframe==None and target==None):
if(self.dataframe.empty!=True):
self.target = widgets.Text(description = 'Enter the target column')
self.target.on_submit(self.target_submit_handler)
display(self.target)
f=AutoMl()
f.initial_setup() //end of file error
解决方法
只需将 classfication_setup
函数中的代码替换为以下代码即可。
x=setup(self.dataframe,"Species",silent=True)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。