You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (Jira)" <ji...@apache.org> on 2022/04/26 09:12:00 UTC

[jira] [Commented] (SPARK-38820) Refresh dtype when astype("category")

    [ https://issues.apache.org/jira/browse/SPARK-38820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17528037#comment-17528037 ] 

Apache Spark commented on SPARK-38820:
--------------------------------------

User 'Yikun' has created a pull request for this issue:
https://github.com/apache/spark/pull/36357

> Refresh dtype when astype("category")
> -------------------------------------
>
>                 Key: SPARK-38820
>                 URL: https://issues.apache.org/jira/browse/SPARK-38820
>             Project: Spark
>          Issue Type: Sub-task
>          Components: PySpark
>    Affects Versions: 3.4.0
>            Reporter: Yikun Jiang
>            Priority: Major
>
> {code:java}
> ERROR [1.717s]: test_astype (pyspark.pandas.tests.data_type_ops.test_boolean_ops.BooleanExtensionOpsTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/__w/spark/spark/python/pyspark/testing/pandasutils.py", line 121, in assertPandasEqual
>     assert_series_equal(
>   File "/usr/local/lib/python3.9/dist-packages/pandas/_testing/asserters.py", line 1019, in assert_series_equal
>     assert_attr_equal("dtype", left, right, obj=f"Attributes of {obj}")
>   File "/usr/local/lib/python3.9/dist-packages/pandas/_testing/asserters.py", line 506, in assert_attr_equal
>     raise_assert_detail(obj, msg, left_attr, right_attr)
> AssertionError: Attributes of Series are differentAttribute "dtype" are different
> [left]:  CategoricalDtype(categories=[False, True], ordered=False)
> [right]: CategoricalDtype(categories=[False, True], ordered=False)The above exception was the direct cause of the following exception:Traceback (most recent call last):
>   File "/__w/spark/spark/python/pyspark/pandas/tests/data_type_ops/test_boolean_ops.py", line 746, in test_astype
>     self.assert_eq(pser.astype("category"), psser.astype("category"))
>   File "/__w/spark/spark/python/pyspark/testing/pandasutils.py", line 229, in assert_eq
>     self.assertPandasEqual(lobj, robj, check_exact=check_exact)
>   File "/__w/spark/spark/python/pyspark/testing/pandasutils.py", line 134, in assertPandasEqual
>     raise AssertionError(msg) from e
> AssertionError: Attributes of Series are differentAttribute "dtype" are different
> [left]:  CategoricalDtype(categories=[False, True], ordered=False)
> [right]: CategoricalDtype(categories=[False, True], ordered=False)Left:
> Name: this, dtype: category
> Categories (2, boolean): [False, True]
> categoryRight:
> Name: this, dtype: category
> Categories (2, object): [False, True]
> category {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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