You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/01/03 06:11:00 UTC

[jira] [Updated] (SPARK-37039) np.nan series.astype(bool) should be True

     [ https://issues.apache.org/jira/browse/SPARK-37039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated SPARK-37039:
-----------------------------------
    Labels: pull-request-available  (was: )

> np.nan series.astype(bool) should be True
> -----------------------------------------
>
>                 Key: SPARK-37039
>                 URL: https://issues.apache.org/jira/browse/SPARK-37039
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark
>    Affects Versions: 3.3.0
>            Reporter: Yikun Jiang
>            Priority: Major
>              Labels: pull-request-available
>
> np.nan series.astype(bool) should be True, rather than Fasle:
> https://github.com/apache/spark/blob/46bcef7472edd40c23afd9ac74cffe13c6a608ad/python/pyspark/pandas/data_type_ops/base.py#L147
> >>> pd.Series([1, 2, np.nan], dtype=float).astype(bool)
> >>> pd.Series([1, 2, np.nan], dtype=str).astype(bool)
> >>> pd.Series([datetime.date(1994, 1, 31), datetime.date(1994, 2, 1), np.nan])
> 0     True
> 1     True
> 2     True
> dtype: bool
> But in pyspark, it is:
> 0     True
> 1     True
> 2     False
> dtype: bool



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org