我制作了一个程序,它使用csv文件并计算平均值。我试着用流光来制作界面。我尝试使用我的程序中的解决方案
data = st.file_uploader("Wybierz pliki CSV:",type = 'csv', accept_multiple_files=True)
for file in data:
Table = pd.read_csv(file, sep=',')
DF1 = pd.DataFrame(Table)
DFL = pd.concat([DFL,DF1], sort=False)当我试图使用st.dataframe(DFL)打印它时,我得到了以下错误:
StreamlitAPIException:(“未能将str:尝试转换为int64的'06028001018‘转换”,“对带有类型对象的列LPROS1的转换失败”)
有人知道怎么处理吗?
发布于 2022-03-27 06:08:53
StreamlitAPIException:(“未能将str:尝试转换为int64的'06028001018‘转换”,“对具有类型对象的列LPROS1的转换失败”)
这是一个 0.85.0附带的bug。pyarrow与numpy.dtype值( df.dtypes返回的值)有问题。
作为解决办法,您可以将下面的行添加到代码中
DF2 = DFL.astype(str)
st.dataframe(DFL2)或者从这里尝试其他建议的解决方法
发布于 2022-03-16 12:28:12
试着这样做:
data = st.file_uploader("Wybierz pliki CSV:",type = 'csv',
accept_multiple_files=True)
Table = []
for file in data:
if file.endswith(".csv"):
Table.append(pd.read_csv(file)
df = pd.concat(Table, sort=False)发布于 2022-03-17 02:12:24
重新检查您的错误消息。
StreamlitAPIException: ("Could not convert '06028001018' with type str: tried to convert to int64", 'Conversion failed for column LPROS1 with type object')它是关于列LPROS1中的数据类型的。
https://stackoverflow.com/questions/71496910
复制相似问题