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



##########
File path: python/pyspark/pandas/tests/test_series.py
##########
@@ -394,6 +394,17 @@ def test_isin(self):
         with self.assertRaisesRegex(TypeError, msg):
             psser.isin(1)
 
+        # when Series have NaN
+        pser = pd.Series(["lama", "cow", None, "lama", "beetle", "lama", 
"hippo", None], name="a")
+        psser = ps.from_pandas(pser)
+
+        self.assert_eq(psser.isin(["cow", "lama"]), pser.isin(["cow", "lama"]))
+
+        pser = pd.Series([None, 5, None, 3, 2, 1, None, 0, 0], name="a")
+        psser = ps.from_pandas(pser)
+
+        self.assert_eq(psser.isin([1, 5, 0, None]), pser.isin([1, 5, 0, None]))

Review comment:
       Seems like this behavior changed in pandas 1.2.
   Could you make this work with pandas <1.2 as well?
   
   ```py
   if LooseVersion(pd.__version__) >= LooseVersion("1.2"):
       self.assert_eq(psser.isin([1, 5, 0, None]), pser.isin([1, 5, 0, None]))
   else:
       expected = pd.Series([ ... ])
       self.assert_eq(psser.isin([1, 5, 0, None]), expected)
   ```




-- 
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