【问题标题】:End of file error due to setup function of pycaret由于 pycaret 的设置功能导致文件结束错误
【发布时间】:2021-04-25 11:51:59
【问题描述】:

我正在制作 Automl 的一个对象,我正在调用函数 initial setup,它显示一个文本小部件,当提交文本时,它调用 target_submit_handler,它在内部调用 classification_setup,它调用 pycaret 库的 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 

这是文件结束错误:

【问题讨论】:

    标签: python data-science ipywidgets pycaret


    【解决方案1】:

    只需将classfication_setup函数中的代码替换为以下代码即可。

    x=setup(self.dataframe, "Species", silent=True)
    

    为了它的工作阅读文档https://pycaret.org/setup/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-19
      • 1970-01-01
      • 2023-01-07
      • 1970-01-01
      相关资源
      最近更新 更多