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


##########
python/pyspark/pandas/indexes/base.py:
##########
@@ -1917,18 +1917,12 @@ def append(self, other: "Index") -> "Index":
         sdf_other = 
other._internal.spark_frame.select(other._internal.index_spark_columns)
         sdf_appended = sdf_self.union(sdf_other)
 
-        # names should be kept when MultiIndex, but Index wouldn't keep its 
name.
-        if isinstance(self, MultiIndex):
-            index_names = self._internal.index_names
-        else:
-            index_names = None
-
         internal = InternalFrame(
             spark_frame=sdf_appended,
             index_spark_columns=[
                 scol_for(sdf_appended, col) for col in 
self._internal.index_spark_column_names
             ],
-            index_names=index_names,
+            index_names=None,

Review Comment:
   We can simply set the `index_names` to `None` to follow the behavior of 
Pandas, since Pandas doesn't keep the name of `MultiIndex` when computing the 
`append` from Pandas 2.0.0. (See 
https://github.com/pandas-dev/pandas/pull/48288 more detail)
   
   cc @zhengruifeng @HyukjinKwon as CI passed.



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