python的df.at功能错误

2024-04-19 01:57:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图让pandas在循环结束时将数据帧中的某个单元格写入变量(即字符串)。我不断得到下面的错误。 代码:

df1.at[i,'Status']=str(result)

回溯错误:

ValueError: could not convert string to float: 'example'

有没有办法使用“df.at”功能输入非数字值


Tags: 数据字符串代码convertpandasstatus错误not