[英].astype(“int”) or .astype(int)? Any differences between with and without quote/double?
I have a DataFrame and one of its column consist of float type objects. 我有一个DataFrame,其中一个列由float类型对象组成。 I want to convert to int.
我想转换为int。 As I tried, both
.astype("int")
and astype(int)
methods work. 正如我所尝试的那样,
.astype("int")
和astype(int)
方法都有效。 I just wonder whether there is/are any difference(s)? 我只是想知道是否存在差异?
AFAIK there is no major difference... AFAIK没有什么重大区别......
.astype(dtype)
should accept everything what is accepted by numpy.dtype() . .astype(dtype)
应该接受一切什么是接受numpy.dtype() 。
Internally it does this: 在内部它这样做:
dtype = np.dtype(dtype)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.