xinrong-databricks commented on a change in pull request #35782:
URL: https://github.com/apache/spark/pull/35782#discussion_r824287831
##########
File path: python/pyspark/pandas/tests/test_series.py
##########
@@ -387,6 +387,28 @@ def test_isin(self):
)
self.assert_eq(psser.isin([1, 5, 0, None]), expected)
+ def test_duplicated(self):
+ for pser in [
+ pd.Series(["beetle", None, "beetle", None, "lama", "beetle"],
name="objects"),
+ pd.Series([1, np.nan, 1, np.nan], name="numbers"),
+ pd.Series(
+ [
+ pd.Timestamp("2022-01-01"),
+ pd.Timestamp("2022-02-02"),
+ pd.Timestamp("2022-01-01"),
+ pd.Timestamp("2022-02-02"),
+ ],
+ name="times",
+ ),
+ ]:
+ psser = ps.from_pandas(pser)
+ self.assert_eq(psser.duplicated().sort_index(), pser.duplicated())
+ self.assert_eq(
+ psser.duplicated(keep="first").sort_index(),
pser.duplicated(keep="first")
+ )
+ self.assert_eq(psser.duplicated(keep="last").sort_index(),
pser.duplicated(keep="last"))
+ self.assert_eq(psser.duplicated(keep=False).sort_index(),
pser.duplicated(keep=False))
Review comment:
Sure added. Then I realized it must have the same result with
`psser.duplicated()` always.. It's still good to have it tested though :)
--
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]