You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/04/20 01:43:49 UTC
[GitHub] [spark] itholic commented on a diff in pull request #36215: [SPARK-38938][PYTHON] Implement `inplace` and `columns` parameters of `Series.drop`
itholic commented on code in PR #36215:
URL: https://github.com/apache/spark/pull/36215#discussion_r853657776
##########
python/pyspark/pandas/tests/test_series.py:
##########
@@ -1749,14 +1759,22 @@ def test_drop(self):
with self.assertRaisesRegex(ValueError, msg):
psser.drop(["lama", ["cow", "falcon"]])
- msg = "Cannot specify both 'labels' and 'index'"
+ msg = "Cannot specify both 'labels' and 'index'/'columns'"
with self.assertRaisesRegex(ValueError, msg):
psser.drop("lama", index="cow")
+ with self.assertRaisesRegex(ValueError, msg):
+ psser.drop("lama", columns="cow")
+
msg = r"'Key length \(2\) exceeds index depth \(3\)'"
with self.assertRaisesRegex(KeyError, msg):
psser.drop(("lama", "speed", "x"))
+ psser.drop({"lama": "speed"}, inplace=True)
+ pser.drop({"lama": "speed"}, inplace=True)
+ self.assert_eq(psser, pser)
+ self.assert_eq(psdf, pdf)
Review Comment:
Oh, can we add a one test for chained case ?
e.g.
```python
(psser + 1).drop({"lama": "speed"}, inplace=True)
(pser + 1).drop({"lama": "speed"}, inplace=True)
self.assert_eq(psser, pser)
self.assert_eq(psdf, pdf)
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org