/:“str”和“float”的操作数类型不受支持

2024-05-19 07:41:28 发布

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

如前所述,我有一个数据帧。 Steam Pressure

在做了简单的数学运算之后,我想添加一个新的列

首先,我尝试:

pd.eval("HRSGHPSteam = df1.HRSGHPStmPressure/1000", target=df1)

这给了我TypeError: unsupported operand type(s) for /: 'object' and '<class 'int'>'

然后我试着

df1['HRSGHPSteam'] = df1['HRSGHPStmPressure']/1000

这给了我TypeError: unsupported operand type(s) for /: 'str' and 'int'

有人能告诉我如何纠正这个问题吗


Tags: and数据fortype数学steamintpd

热门问题