You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fillna function does not support the decimal type. If you have a column of DecimalType, which gets converted to decimal.Decimal (and is shown as object type by koalas), the straightforward way of using fillna will give you an error TypeError: Unsupported type Decimal
Currently you can work around this by filling with a float or a double and then recast the column to the decimaltype. This is however cumbersome and you cannot reuse the same code for different types, because you need to explicitly check if you're dealing with decimal types to prevent the error.
kdf["test"] =kdf["test"].fillna(float(m)).astype(decimal.Decimal) # No TypeError
Suggested solution
It seems there are hardcoded type checks in the _fillna implementation (here and here). Add the decimal.Decimal type to that check to prevent the error. I'm not qualified to assess whether this solution is appropriate, hence this issue ticket :)
The text was updated successfully, but these errors were encountered:
Description
The
fillna
function does not support the decimal type. If you have a column of DecimalType, which gets converted to decimal.Decimal (and is shown as object type by koalas), the straightforward way of using fillna will give you an errorTypeError: Unsupported type Decimal
Example code:
Workaround
Currently you can work around this by filling with a float or a double and then recast the column to the decimaltype. This is however cumbersome and you cannot reuse the same code for different types, because you need to explicitly check if you're dealing with decimal types to prevent the error.
Suggested solution
It seems there are hardcoded type checks in the
_fillna
implementation (here and here). Add thedecimal.Decimal
type to that check to prevent the error. I'm not qualified to assess whether this solution is appropriate, hence this issue ticket :)The text was updated successfully, but these errors were encountered: