itholic commented on code in PR #42793:
URL: https://github.com/apache/spark/pull/42793#discussion_r1319286522


##########
python/pyspark/pandas/tests/frame/test_reshaping.py:
##########
@@ -291,7 +291,8 @@ def test_stack(self):
         psdf_multi_level_cols2 = ps.from_pandas(pdf_multi_level_cols2)
 
         self.assert_eq(
-            psdf_multi_level_cols2.stack().sort_index(), 
pdf_multi_level_cols2.stack().sort_index()
+            psdf_multi_level_cols2.stack().sort_index()[["weight", "height"]],
+            pdf_multi_level_cols2.stack().sort_index()[["weight", "height"]],

Review Comment:
   This just for handling the column order:
   
   **DataFrame**
   ```python
   >>> pdf
       weight height
           kg      m
   cat    1.0    2.0
   dog    3.0    4.0
   ```
   
   **DataFrame.stack() in Pandas 1.5.3**
   ```python
   >>> pdf.stack()
           weight  height
   cat kg     1.0     NaN
       m      NaN     2.0
   dog kg     3.0     NaN
       m      NaN     4.0
   ```
   
   **DataFrame.stack() in Pandas 2.1.0**
   ```python
   >>> pdf.stack()
           weight  height
   cat kg     1.0     NaN
       m      NaN     2.0
   dog kg     3.0     NaN
       m      NaN     4.0
   ```
   
   I think maybe this is the minor bug in Pandas, so I reported for the Pandas 
community to make sure.



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