标签: python python-3.x
我无法理解为什么在从int转换为string的字符串发布的末尾添加零点。
下面是我要转换的代码:
df['attendees_num'].astype(str)
在这里,与会者的数字值为20,但其输出为20.0。有人可以帮我如何将其转换为20个字符串,结尾没有.0。?
答案 0 :(得分:4)
这应该做到:
df['attendees_num'].astype(int).astype(str)