Skip to content

Commit e56d395

Browse files
author
dilex42
authored
DOC: Partial fix SA04 errors in docstrings #28792 (feedback needed) (#32823)
1 parent eab7226 commit e56d395

File tree

8 files changed

+56
-64
lines changed

8 files changed

+56
-64
lines changed

pandas/core/accessor.py

+6-16
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ def _register_accessor(name, cls):
211211
212212
See Also
213213
--------
214-
{others}
214+
register_dataframe_accessor : Register a custom accessor on DataFrame objects.
215+
register_series_accessor : Register a custom accessor on Series objects.
216+
register_index_accessor : Register a custom accessor on Index objects.
215217
216218
Notes
217219
-----
@@ -279,33 +281,21 @@ def decorator(accessor):
279281
return decorator
280282

281283

282-
@doc(
283-
_register_accessor,
284-
klass="DataFrame",
285-
others="register_series_accessor, register_index_accessor",
286-
)
284+
@doc(_register_accessor, klass="DataFrame")
287285
def register_dataframe_accessor(name):
288286
from pandas import DataFrame
289287

290288
return _register_accessor(name, DataFrame)
291289

292290

293-
@doc(
294-
_register_accessor,
295-
klass="Series",
296-
others="register_dataframe_accessor, register_index_accessor",
297-
)
291+
@doc(_register_accessor, klass="Series")
298292
def register_series_accessor(name):
299293
from pandas import Series
300294

301295
return _register_accessor(name, Series)
302296

303297

304-
@doc(
305-
_register_accessor,
306-
klass="Index",
307-
others="register_dataframe_accessor, register_series_accessor",
308-
)
298+
@doc(_register_accessor, klass="Index")
309299
def register_index_accessor(name):
310300
from pandas import Index
311301

pandas/core/arrays/categorical.py

+36-36
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,12 @@ def categories(self):
416416
417417
See Also
418418
--------
419-
rename_categories
420-
reorder_categories
421-
add_categories
422-
remove_categories
423-
remove_unused_categories
424-
set_categories
419+
rename_categories : Rename categories.
420+
reorder_categories : Reorder categories.
421+
add_categories : Add new categories.
422+
remove_categories : Remove the specified categories.
423+
remove_unused_categories : Remove categories which are not used.
424+
set_categories : Set the categories to the specified ones.
425425
"""
426426
return self.dtype.categories
427427

@@ -830,11 +830,11 @@ def set_categories(self, new_categories, ordered=None, rename=False, inplace=Fal
830830
831831
See Also
832832
--------
833-
rename_categories
834-
reorder_categories
835-
add_categories
836-
remove_categories
837-
remove_unused_categories
833+
rename_categories : Rename categories.
834+
reorder_categories : Reorder categories.
835+
add_categories : Add new categories.
836+
remove_categories : Remove the specified categories.
837+
remove_unused_categories : Remove categories which are not used.
838838
"""
839839
inplace = validate_bool_kwarg(inplace, "inplace")
840840
if ordered is None:
@@ -901,11 +901,11 @@ def rename_categories(self, new_categories, inplace=False):
901901
902902
See Also
903903
--------
904-
reorder_categories
905-
add_categories
906-
remove_categories
907-
remove_unused_categories
908-
set_categories
904+
reorder_categories : Reorder categories.
905+
add_categories : Add new categories.
906+
remove_categories : Remove the specified categories.
907+
remove_unused_categories : Remove categories which are not used.
908+
set_categories : Set the categories to the specified ones.
909909
910910
Examples
911911
--------
@@ -969,11 +969,11 @@ def reorder_categories(self, new_categories, ordered=None, inplace=False):
969969
970970
See Also
971971
--------
972-
rename_categories
973-
add_categories
974-
remove_categories
975-
remove_unused_categories
976-
set_categories
972+
rename_categories : Rename categories.
973+
add_categories : Add new categories.
974+
remove_categories : Remove the specified categories.
975+
remove_unused_categories : Remove categories which are not used.
976+
set_categories : Set the categories to the specified ones.
977977
"""
978978
inplace = validate_bool_kwarg(inplace, "inplace")
979979
if set(self.dtype.categories) != set(new_categories):
@@ -1009,11 +1009,11 @@ def add_categories(self, new_categories, inplace=False):
10091009
10101010
See Also
10111011
--------
1012-
rename_categories
1013-
reorder_categories
1014-
remove_categories
1015-
remove_unused_categories
1016-
set_categories
1012+
rename_categories : Rename categories.
1013+
reorder_categories : Reorder categories.
1014+
remove_categories : Remove the specified categories.
1015+
remove_unused_categories : Remove categories which are not used.
1016+
set_categories : Set the categories to the specified ones.
10171017
"""
10181018
inplace = validate_bool_kwarg(inplace, "inplace")
10191019
if not is_list_like(new_categories):
@@ -1058,11 +1058,11 @@ def remove_categories(self, removals, inplace=False):
10581058
10591059
See Also
10601060
--------
1061-
rename_categories
1062-
reorder_categories
1063-
add_categories
1064-
remove_unused_categories
1065-
set_categories
1061+
rename_categories : Rename categories.
1062+
reorder_categories : Reorder categories.
1063+
add_categories : Add new categories.
1064+
remove_unused_categories : Remove categories which are not used.
1065+
set_categories : Set the categories to the specified ones.
10661066
"""
10671067
inplace = validate_bool_kwarg(inplace, "inplace")
10681068
if not is_list_like(removals):
@@ -1100,11 +1100,11 @@ def remove_unused_categories(self, inplace=False):
11001100
11011101
See Also
11021102
--------
1103-
rename_categories
1104-
reorder_categories
1105-
add_categories
1106-
remove_categories
1107-
set_categories
1103+
rename_categories : Rename categories.
1104+
reorder_categories : Reorder categories.
1105+
add_categories : Add new categories.
1106+
remove_categories : Remove the specified categories.
1107+
set_categories : Set the categories to the specified ones.
11081108
"""
11091109
inplace = validate_bool_kwarg(inplace, "inplace")
11101110
cat = self if inplace else self.copy()

pandas/core/dtypes/dtypes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class CategoricalDtype(PandasExtensionDtype, ExtensionDtype):
194194
195195
See Also
196196
--------
197-
Categorical
197+
Categorical : Represent a categorical variable in classic R / S-plus fashion.
198198
199199
Notes
200200
-----

pandas/core/indexes/multi.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,8 @@ def to_frame(self, index=True, name=None):
15841584
15851585
See Also
15861586
--------
1587-
DataFrame
1587+
DataFrame : Two-dimensional, size-mutable, potentially heterogeneous
1588+
tabular data.
15881589
"""
15891590
from pandas import DataFrame
15901591

pandas/io/html.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ def read_html(
10361036
10371037
See Also
10381038
--------
1039-
read_csv
1039+
read_csv : Read a comma-separated values (csv) file into DataFrame.
10401040
10411041
Notes
10421042
-----

pandas/io/sql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def read_sql_query(
313313
See Also
314314
--------
315315
read_sql_table : Read SQL database table into a DataFrame.
316-
read_sql
316+
read_sql : Read SQL query or database table into a DataFrame.
317317
318318
Notes
319319
-----

pandas/plotting/_misc.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def table(ax, data, rowLabels=None, colLabels=None, **kwargs):
2929

3030
def register():
3131
"""
32-
Register Pandas Formatters and Converters with matplotlib.
32+
Register pandas formatters and converters with matplotlib.
3333
3434
This function modifies the global ``matplotlib.units.registry``
35-
dictionary. Pandas adds custom converters for
35+
dictionary. pandas adds custom converters for
3636
3737
* pd.Timestamp
3838
* pd.Period
@@ -43,15 +43,15 @@ def register():
4343
4444
See Also
4545
--------
46-
deregister_matplotlib_converters
46+
deregister_matplotlib_converters : Remove pandas formatters and converters.
4747
"""
4848
plot_backend = _get_plot_backend("matplotlib")
4949
plot_backend.register()
5050

5151

5252
def deregister():
5353
"""
54-
Remove pandas' formatters and converters.
54+
Remove pandas formatters and converters.
5555
5656
Removes the custom converters added by :func:`register`. This
5757
attempts to set the state of the registry back to the state before
@@ -62,7 +62,8 @@ def deregister():
6262
6363
See Also
6464
--------
65-
register_matplotlib_converters
65+
register_matplotlib_converters : Register pandas formatters and converters
66+
with matplotlib.
6667
"""
6768
plot_backend = _get_plot_backend("matplotlib")
6869
plot_backend.deregister()
@@ -155,7 +156,7 @@ def radviz(frame, class_column, ax=None, color=None, colormap=None, **kwds):
155156
Parameters
156157
----------
157158
frame : `DataFrame`
158-
Pandas object holding the data.
159+
pandas object holding the data.
159160
class_column : str
160161
Column name containing the name of the data point category.
161162
ax : :class:`matplotlib.axes.Axes`, optional
@@ -270,7 +271,7 @@ def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds):
270271
Parameters
271272
----------
272273
series : pandas.Series
273-
Pandas Series from where to get the samplings for the bootstrapping.
274+
pandas Series from where to get the samplings for the bootstrapping.
274275
fig : matplotlib.figure.Figure, default None
275276
If given, it will use the `fig` reference for plotting instead of
276277
creating a new one with default parameters.

pandas/tseries/frequencies.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def to_offset(freq) -> Optional[DateOffset]:
9191
9292
See Also
9393
--------
94-
DateOffset
94+
DateOffset : Standard kind of date increment used for a date range.
9595
9696
Examples
9797
--------

0 commit comments

Comments
 (0)