python – Pandas读取sql整数变为浮点数
我遇到了一个问题,当我使用pandas读取Mysql表时,一些列(参见’to_nlc’)曾经是整数变成了一个浮点数(之后自动添加.0).
解决方法问题是您的数据包含NaN值,因此int会自动转换为float.我想你可以查看NA type promotions:
Typeclass Promotion dtype for storing NAs floating no change object no change integer cast to float64 boolean cast to object
(编辑:莱芜站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |