[英]StringDtype data type not understood
When converting from an extension type, eg pd.Int32Dtype()
, I get TypeError: data type not understood
.从扩展类型转换时,例如
pd.Int32Dtype()
,我得到TypeError: data type not understood
pd.Int32Dtype()
。 Example:例子:
num_col_with_nan = num_col_with_nan.astype(pd.Int32Dtype()).astype("string")
Casting between extension types is not yet supported - see #22384 for general overview and #31204 for StringDtype in particular.尚不支持扩展类型之间的转换 - 请参阅#22384了解一般概述,特别是#31204了解 StringDtype。
As a workaround, try casting to str first:作为解决方法,请先尝试强制转换为 str:
num_col_with_nan = num_col_with_nan.astype(pd.Int32Dtype()).astype(str).astype("string")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.