2024-05-16 07:16:23 发布
网友
我正在尝试运行SerendipSlim主题模型可视化工具。我使用了附带的脚本,用MALLET(VEP_TMScripts)生成了一个主题模型。当使用SerendipSlim读取创建的模型时,此行抛出以下错误:
topicNum = int(row[i]) ValueError: invalid literal for int() with base 10: '0.0032876898047722344'
有什么办法克服它吗?你知道吗
如果您只想像前面提到的那样“传递”它,可以使用float()表示十进制数。你知道吗
topicNum = float(row[i])。你知道吗
topicNum = float(row[i])
对于int表示,应使用:
import math new_topic_num = math.ceil(topicNum) print new_topic_num >> 1.0
现在您可以在以后的for i in range(int(new_topic_num))中重新使用int
for i in range(int(new_topic_num))
int
如果您只想像前面提到的那样“传递”它,可以使用float()表示十进制数。你知道吗
topicNum = float(row[i])
。你知道吗对于int表示,应使用:
现在您可以在以后的
for i in range(int(new_topic_num))
中重新使用int
相关问题 更多 >
编程相关推荐