不理解的 StringDtype 数据类型

StringDtype data type not understood

从扩展类型转换时,例如pd.Int32Dtype(),我得到 TypeError: data type not understood。示例:

num_col_with_nan = num_col_with_nan.astype(pd.Int32Dtype()).astype("string")

尚不支持扩展类型之间的转换 - 请参阅 #22384 for general overview and #31204,特别是 StringDtype。

作为解决方法,请先尝试转换为 str:

num_col_with_nan = num_col_with_nan.astype(pd.Int32Dtype()).astype(str).astype("string")