[
https://issues.apache.org/jira/browse/SPARK-19732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15975369#comment-15975369
]
Srinivasa Reddy Vundela commented on SPARK-19732:
-------------------------------------------------
Hi [~lenfro], I was checking the documentation for fillna (python API) and
na.fill(scala API). Both places I see that supported datatypes for value are
either String or Numerical type (int, float, double). So, this surely not a bug
as the implementation is in sync with documentation. May be this can be changed
to enhancement.
> DataFrame.fillna() does not work for bools in PySpark
> -----------------------------------------------------
>
> Key: SPARK-19732
> URL: https://issues.apache.org/jira/browse/SPARK-19732
> Project: Spark
> Issue Type: Bug
> Components: PySpark
> Affects Versions: 2.1.0
> Reporter: Len Frodgers
>
> In PySpark, the fillna function of DataFrame inadvertently casts bools to
> ints, so fillna cannot be used to fill True/False.
> e.g.
> `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()`
> yields
> `[Row(a=True), Row(a=None)]`
> It should be a=True for the second Row
> The cause is this bit of code:
> {code}
> if isinstance(value, (int, long)):
> value = float(value)
> {code}
> There needs to be a separate check for isinstance(bool), since in python,
> bools are ints too
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]