@@ -112,12 +112,42 @@ def print_column(df, col):
112112 method_signature = inspect .signature (method )
113113
114114 def inner (* args , ** kwargs ):
115+ """Inner function to register the method.
116+
117+ This function is called when the user
118+ decorates a function with register_dataframe_method.
119+
120+ Args:
121+ *args: The arguments to pass to the registered method.
122+ **kwargs: The keyword arguments to pass to the registered method.
123+
124+ Returns:
125+ method: The original method.
126+ """
127+
115128 class AccessorMethod (object ):
129+ """DataFrame Accessor method class."""
130+
116131 def __init__ (self , pandas_obj ):
132+ """Initialize the accessor method class.
133+
134+ Args:
135+ pandas_obj (pandas.DataFrame): The pandas DataFrame object.
136+ """
117137 self ._obj = pandas_obj
118138
119139 @wraps (method )
120140 def __call__ (self , * args , ** kwargs ):
141+ """Call the accessor method.
142+
143+ Args:
144+ *args: The arguments to pass to the registered method.
145+ **kwargs: The keyword arguments to pass
146+ to the registered method.
147+
148+ Returns:
149+ object: The result of calling of the method.
150+ """
121151 global method_call_ctx_factory
122152 if method_call_ctx_factory is None :
123153 return method (self ._obj , * args , ** kwargs )
@@ -147,13 +177,30 @@ def register_series_method(method):
147177
148178 def inner (* args , ** kwargs ):
149179 class AccessorMethod (object ):
180+ """Series Accessor method class."""
181+
150182 __doc__ = method .__doc__
151183
152184 def __init__ (self , pandas_obj ):
185+ """Initialize the accessor method class.
186+
187+ Args:
188+ pandas_obj (pandas.Series): The pandas Series object.
189+ """
153190 self ._obj = pandas_obj
154191
155192 @wraps (method )
156193 def __call__ (self , * args , ** kwargs ):
194+ """Call the accessor method.
195+
196+ Args:
197+ *args: The arguments to pass to the registered method.
198+ **kwargs: The keyword arguments to pass
199+ to the registered method.
200+
201+ Returns:
202+ object: The result of calling of the method.
203+ """
157204 global method_call_ctx_factory
158205 if method_call_ctx_factory is None :
159206 return method (self ._obj , * args , ** kwargs )
0 commit comments