Skip to content

Commit 421f47d

Browse files
authored
DOC: fix RT03 for pandas.Index.to_numpy and pandas.Categorial.set_categories (#57603)
* Add description to Index._to_numpy method. * Fix description of default value for parameter "ordered" in set_categories * Add description to return value of Categorical.set_categories and fix typo in description. * Remove fixed docstrings from code_checks.sh
1 parent 3f05c4f commit 421f47d

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Diff for: ci/code_checks.sh

-2
Original file line numberDiff line numberDiff line change
@@ -1882,8 +1882,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
18821882

18831883
MSG='Partially validate docstrings (RT03)' ; echo $MSG
18841884
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=RT03 --ignore_functions \
1885-
pandas.Index.to_numpy\
1886-
pandas.Categorical.set_categories\
18871885
pandas.CategoricalIndex.set_categories\
18881886
pandas.DataFrame.astype\
18891887
pandas.DataFrame.at_time\

Diff for: pandas/core/arrays/categorical.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1064,14 +1064,14 @@ def set_categories(
10641064
On the other hand this methods does not do checks (e.g., whether the
10651065
old categories are included in the new categories on a reorder), which
10661066
can result in surprising changes, for example when using special string
1067-
dtypes, which does not considers a S1 string equal to a single char
1067+
dtypes, which do not consider a S1 string equal to a single char
10681068
python string.
10691069
10701070
Parameters
10711071
----------
10721072
new_categories : Index-like
10731073
The categories in new order.
1074-
ordered : bool, default False
1074+
ordered : bool, default None
10751075
Whether or not the categorical is treated as a ordered categorical.
10761076
If not given, do not change the ordered information.
10771077
rename : bool, default False
@@ -1080,7 +1080,8 @@ def set_categories(
10801080
10811081
Returns
10821082
-------
1083-
Categorical with reordered categories.
1083+
Categorical
1084+
New categories to be used, with optional ordering changes.
10841085
10851086
Raises
10861087
------

Diff for: pandas/core/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,8 @@ def to_numpy(
566566
Returns
567567
-------
568568
numpy.ndarray
569+
The NumPy ndarray holding the values from this Series or Index.
570+
The dtype of the array may differ. See Notes.
569571
570572
See Also
571573
--------

0 commit comments

Comments
 (0)