我已经从这里安装了python软件包CHAID包,我正在尝试将CHAID导入到我的笔记本中。但是当我导入包时,我得到了一个语法错误。
from CHAID import Tree错误信息:
File "C:\...\Local\Continuum\anaconda3\lib\site-packages\CHAID\graph.py", line 75
file = 'C:\...\Documents\Python Scripts\CHAID\temp\' + ("%.20f" % time.time()).replace('.', '') + '.png'
^
SyntaxError: invalid syntax我在这里找到了这个链接链接,但是那里的解决方案对我没有用,因为我甚至不能导入Chaid库。我该怎么做才能让它发挥作用?thx
编辑最新版本不再使用line 75 of graph.py方法,因此如果升级到5.3.0或更高版本将得到解决
发布于 2020-04-06 12:31:42
很可能,这个包是用Python2.x编写的,而您使用的是Python3.x。
发布于 2020-04-09 01:56:28
将r添加到字符串文本中。
file = r'C:\...\Documents\Python Scripts\CHAID\temp\'或者使用双反斜杠:
file = 'C:\\...\\Documents\\Python Scripts\\CHAID\\temp\\'https://stackoverflow.com/questions/61059742
复制相似问题