我试过用if df.loc[df['col_1']] == float:
print(df.loc[df['col_1']])但这不起作用。我基本上只想float在列中找到所有数据类型,看看它是什么以及在哪里。我该怎么做?我需要这样做,因为该列是一个对象,df.dtypes但是在尝试对其进行字符串操作时,我得到一个TypeError有浮点数的信息。
2 回答

守着星空守着你
TA贡献1799条经验 获得超8个赞
所以我假设你有column
type
is object
,通常pandas
每列只有一种数据类型
df.col_1.map(type)==float# will return bool
添加回答
举报
0/150
提交
取消