itholic commented on a change in pull request #33471:
URL: https://github.com/apache/spark/pull/33471#discussion_r675248719



##########
File path: python/pyspark/pandas/categorical.py
##########
@@ -442,8 +442,110 @@ def remove_categories(
     def remove_unused_categories(self) -> "ps.Series":
         raise NotImplementedError()
 
-    def rename_categories(self, new_categories: pd.Index, inplace: bool = 
False) -> "ps.Series":
-        raise NotImplementedError()
+    def rename_categories(
+        self, new_categories: Union[list, dict, Callable], inplace: bool = 
False
+    ) -> Optional["ps.Series"]:
+        """
+        Rename categories.
+
+        Parameters
+        ----------
+        new_categories : list-like, dict-like or callable
+
+            New categories which will replace old categories.
+
+            * list-like: all items must be unique and the number of items in
+              the new categories must match the existing number of categories.
+
+            * dict-like: specifies a mapping from
+              old categories to new. Categories not contained in the mapping
+              are passed through and extra categories in the mapping are
+              ignored.
+
+            * callable : a callable that is called on all items in the old
+              categories and whose return values comprise the new categories.
+
+        inplace : bool, default False
+            Whether or not to rename the categories inplace or return a copy of
+            this categorical with renamed categories.

Review comment:
       `inplace` is deprecated since pandas 1.2.0.
   
   <img width="795" alt="Screen Shot 2021-07-23 at 9 52 27 AM" 
src="https://user-images.githubusercontent.com/44108233/126726128-a9aef1e5-5eef-45ec-9182-2250f60560cc.png";>
   
   Maybe should we also raise the deprecation warnings ?




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to