【发布时间】:2019-03-18 18:33:24
【问题描述】:
我目前正在研究检测心律失常的神经网络。卷积神经网络已被实现为 Flask Web 应用程序的后端。我的程序基于Github repository
但是,我在 Anaconda 终端中遇到了这个问题。 由于某种原因,无法将CSV 中的字符串转换为int 或float 数据类型。 GitHub 声明文件中没有逗号,但它似乎可以很好地加载到 Excel 和 Spyder 中。
这个问题是因为没有逗号的问题还是和程序本身有关?我整个上午都在试图解决这个问题,但无济于事。任何帮助将不胜感激。
File "app.py", line 47, in model_predict
ts = int((str(path)[index1:index2])) ### this is the line causing the error
ValueError: invalid literal for int() with base 10: 'ds\\sample'
这是导致问题的详细信息:
def model_predict(uploaded_files, model):
flag = 1
for path in uploaded_files:
index1 = str(path).find('sig-2') + 6
index2 = -4
ts = int((str(path)[index1:index2])) ### this is the line causing the error
【问题讨论】:
-
您是否真的在阅读每个 CSV 的内容?
path实际上是文件系统路径吗?如果是,您希望ts持有什么? -
@PeterLeimbigler "path" 是 CSV 文件的文件系统路径。 ts 保存应该是时间序列的值
-
@PeterLeimbigler 该程序可在 GitHub 上(链接)的 app.py 文件中找到,因此可以在那里找到完整的代码,以便为该错误提供更多背景信息。程序确实应该读取每个 CSV,但可能存在阻止它这样做的错误。
标签: python neural-network time-series conv-neural-network valueerror