简体   繁体   中英

StringDtype data type not understood

When converting from an extension type, eg pd.Int32Dtype() , I get TypeError: data type not understood . 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.

As a workaround, try casting to str first:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM