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 2021/10/05 06:40:32 UTC

[GitHub] [spark] dchvn commented on a change in pull request #34179: [SPARK-36930][PYTHON] Add dtypes for MultiIndex

dchvn commented on a change in pull request #34179:
URL: https://github.com/apache/spark/pull/34179#discussion_r721931454



##########
File path: python/pyspark/pandas/indexes/multi.py
##########
@@ -375,6 +375,15 @@ def name(self) -> Name:
     def name(self, name: Name) -> None:
         raise PandasNotImplementedError(class_name="pd.MultiIndex", property_name="name")
 
+    @property
+    def dtypes(self) -> Series:
+        return pd.Series(
+            [field.dtype for field in self._internal.index_fields],
+            index=pd.Index(
+                [name if len(name) > 1 else name[0] for name in self._internal.index_names]
+            ),
+        )

Review comment:
       Thank you, I will update. I copied behavior of ps.DataFrame.dtypes. Should we change it too?
   https://github.com/apache/spark/blob/d6786e036d610476a3be0fca5b16ba819dcbc013/python/pyspark/pandas/frame.py#L6276




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