Reputation: 752
When converting from an extension type, e.g. pd.Int32Dtype()
, I get TypeError: data type not understood
. Example:
num_col_with_nan = num_col_with_nan.astype(pd.Int32Dtype()).astype("string")
Upvotes: 0
Views: 1279
Reputation: 752
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")
Upvotes: 1