熊猫数据框中的AttributeError :(“浮动对象没有属性'strip'”,“发生在索引DIV')?

时间:2020-10-28 10:29:07

标签: python python-3.x pandas numpy

我想在我的熊猫数据框中删除空格。 我在数据框d1中使用以下代码。

cols = df1.select_dtypes(object).columns df1 [cols] = df1 [cols] .applymap(lambda x:x.strip())

但是出现以下错误:

df1 [cols] = df1 [cols] .applymap(lambda x:x.strip()) AttributeError :(““ float”对象没有属性“ strip””,“发生在索引DIV”)。

如何摆脱这种情况?

0 个答案:

没有答案