我有一个数据框,其中有几列具有dtype的float。
temp = df.query("temp" > 10.00, inplace = True)
我收到此错误:
TypeError: '>' not supported between instances of 'str' and 'float'
此外,通过使用pd.to_numeric()
option查找想法仍然会引发此错误。
df.temp = pd.to_numeric(df.temp, errors='coerce')
query()方法仅接受字符串表达式。
尝试这个:
df.query('temp > 10', inplace = True)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句