[
https://issues.apache.org/jira/browse/SPARK-38820?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Hyukjin Kwon resolved SPARK-38820.
----------------------------------
Fix Version/s: 3.4.0
Resolution: Fixed
Issue resolved by pull request 36357
[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
> Assignee: Yikun Jiang
> Priority: Major
> Fix For: 3.4.0
>
>
> {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: [email protected]
For additional commands, e-mail: [email protected]