pandas.api.extensions.ExtensionArray.astype#

ExtensionArray.astype(dtype, copy=True)[源代码]#

强制转换为具有‘dtype’的NumPy数组或Extension数组。

参数
dtype字符串或数据类型

数组转换到的类型代码或数据类型。

copy布尔值,默认为True

是否复制数据,即使不是必需的。如果为FALSE,则仅当旧数据类型与新数据类型不匹配时才创建副本。

退货
arrayNp.ndarray或扩展数组

如果dtype为ExtensionDtype,则为Extension数组,否则为Dtype为‘dtype’的NumPy ndarray。