0
我有熊猫DF,它有几个int type
数据作为字符串和浮点数。 我想将所有可以转换为int
的数据转换为int
,否则保持原样。如何在熊猫中将所有int转换数据转换为int?
# something like
df = df.applymap(lambda x: int(x) if type(int(x)) is int else x)
# this code is wrong and is something like x/y problem. But, is there a easy way workout this problem.
感谢,
你不能有hetergenous类型的大熊猫列,除非你用'object' D型。这不是一件好事。 –