File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -116,12 +116,14 @@ def _setter(self, new_values):
116
116
doc = getattr (delegate , accessor_mapping (name )).__doc__ ,
117
117
)
118
118
119
+ from functools import wraps
120
+
119
121
def _create_delegator_method (name : str ):
120
- def f (self , * args , ** kwargs ):
121
- return self ._delegate_method (name , * args , ** kwargs )
122
+ original_method = getattr (delegate , accessor_mapping (name ))
122
123
123
- f .__name__ = name
124
- f .__doc__ = getattr (delegate , accessor_mapping (name )).__doc__
124
+ @wraps (original_method )
125
+ def f (self ):
126
+ return self ._delegate_method (name )
125
127
126
128
return f
127
129
Original file line number Diff line number Diff line change @@ -1155,6 +1155,12 @@ def rename_categories(self, new_categories) -> Self:
1155
1155
"""
1156
1156
Rename categories.
1157
1157
1158
+ This method is commonly used to re-label or adjust the
1159
+ category names in categorical data without changing the
1160
+ underlying data. It is useful in situations where you want
1161
+ to modify the labels used for clarity, consistency,
1162
+ or readability.
1163
+
1158
1164
Parameters
1159
1165
----------
1160
1166
new_categories : list-like, dict-like or callable
@@ -1371,8 +1377,8 @@ def remove_categories(self, removals) -> Self:
1371
1377
"""
1372
1378
Remove the specified categories.
1373
1379
1374
- `removals` must be included in the old categories. Values which were in
1375
- the removed categories will be set to NaN
1380
+ `` removals`` must be included in the old categories,
1381
+ values which were in the removed categories will be set to NaN
1376
1382
1377
1383
Parameters
1378
1384
----------
@@ -1431,6 +1437,10 @@ def remove_unused_categories(self) -> Self:
1431
1437
"""
1432
1438
Remove categories which are not used.
1433
1439
1440
+ This method is useful when working with datasets
1441
+ that undergo dynamic changes where categories may no longer be
1442
+ relevant, allowing to maintain a clean, efficient data structure.
1443
+
1434
1444
Returns
1435
1445
-------
1436
1446
Categorical
You can’t perform that action at this time.
0 commit comments