数据帧插值类型错误::输入类型不支持ufunc“isnan”

2024-09-30 14:21:13 发布

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

我试图在所有列都是dtype float64的数据帧中插入NaN值。 虽然默认的“线性”方法有效:

doseframe3 = doseframe2.interpolate(method = 'linear', axis = 1, limit_direction = 'both')

几乎任何其他方法(如“立方”或“二次”)都会抛出类型错误:

TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

我想澄清一下:

  • 所有列都是dtype float64
  • 我尝试将索引和列转换为float64,但没有任何好处

我需要帮助。 插值前的数据如下所示: Data before interpolation


Tags: theto数据方法not线性nanmethod
1条回答
网友
1楼 · 发布于 2024-09-30 14:21:13

我意识到将列名转换为float64不起作用。一旦我成功地做到了这一点,插值工作得很好

关键点似乎是索引的使用(在列内插值时)或列名的使用(在行内插值时)。这不能是对象或str

相关问题 更多 >