ueshin commented on a change in pull request #33817:
URL: https://github.com/apache/spark/pull/33817#discussion_r695233945



##########
File path: python/pyspark/pandas/tests/test_categorical.py
##########
@@ -214,17 +211,23 @@ def test_as_ordered_unordered(self):
         pser.cat.as_ordered(inplace=True)
         psser.cat.as_ordered(inplace=True)
         if LooseVersion(pd.__version__) >= LooseVersion("1.3"):
-            # TODO(SPARK-36367): Fix the behavior to follow pandas >= 1.3
-            pass
-        else:
-            self.assert_eq(pser, psser)
+            # Bug in pandas 1.3. dtype is not updated properly with `inplace` 
argument.
+            pser = pser.astype(CategoricalDtype(categories=[1, 2, 3], 
ordered=True))
+
+        self.assert_eq(pser, psser)
+

Review comment:
       nit: Shall we remove an extra line here?

##########
File path: python/pyspark/pandas/tests/test_categorical.py
##########
@@ -448,10 +451,7 @@ def identity(x) -> ps.Series[psdf.b.dtype]:  # type: ignore
         def astype(x) -> ps.Series[dtype]:
             return x.astype(dtype)
 
-        if LooseVersion(pd.__version__) >= LooseVersion("1.3"):
-            # TODO(SPARK-36367): Fix the behavior to follow pandas >= 1.3
-            pass
-        elif LooseVersion(pd.__version__) >= LooseVersion("1.2"):
+        if LooseVersion(pd.__version__) >= LooseVersion("1.2"):

Review comment:
       This behavior was change in pandas 1.3, right?
   It seems to fail with pandas 1.2 now.
   Also could you check with the older pandas?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to