0

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

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

1 回答 1

0

尚不支持在扩展类型之间进行强制转换 - 请参阅#22384了解总体概述,特别参阅 # 31204了解StringDtype。

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

num_col_with_nan = num_col_with_nan.astype(pd.Int32Dtype()).astype(str).astype("string")
于 2020-03-18T10:22:17.247 回答