Yikun commented on code in PR #36452:
URL: https://github.com/apache/spark/pull/36452#discussion_r867292067


##########
python/pyspark/pandas/tests/test_groupby.py:
##########
@@ -35,6 +35,19 @@
 
 
 class GroupByTest(PandasOnSparkTestCase, TestUtils):
+    def pdf(self):
+        return pd.DataFrame(
+            {
+                "A": [1, 2, 1, 2],
+                "B": [3.1, 4.1, 4.1, 3.1],
+                "C": ["a", "b", "b", "a"],
+                "D": [True, False, False, True],
+            }
+        )
+
+    def psdf(self):

Review Comment:
   same



##########
python/pyspark/pandas/tests/test_groupby.py:
##########
@@ -35,6 +35,19 @@
 
 
 class GroupByTest(PandasOnSparkTestCase, TestUtils):
+    def pdf(self):

Review Comment:
   nit: let's add `@property` for `pdf` and `psdf` to:
   1. Simply pdf init like `x=self.pdf` instead of `x=self.pdf()`
   2. Keep the pdf/psdf property style with other tests
   3. Make pdf/psdf read only, if some try to set pdf accidently will raise: 
`AttributeError: can't set attribute`



##########
python/pyspark/pandas/groupby.py:
##########
@@ -2673,7 +2682,7 @@ def get_group(self, name: Union[Name, List[Name]]) -> 
FrameLike:
 
         return self._cleanup_and_return(DataFrame(internal))
 
-    def median(self, numeric_only: bool = True, accuracy: int = 10000) -> 
FrameLike:
+    def median(self, numeric_only: Optional[bool] = True, accuracy: int = 
10000) -> FrameLike:

Review Comment:
   I think it's ok for me, and you have added the regression test for 
`SeriesGroupBy` we can easy to catch this change if pandas changes these logic.



-- 
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-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to