Skip to content

DOC: fix RT03 for pandas.Index.to_numpy and pandas.Categorial.set_categories #57603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1882,8 +1882,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then

MSG='Partially validate docstrings (RT03)' ; echo $MSG
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=RT03 --ignore_functions \
pandas.Index.to_numpy\
pandas.Categorical.set_categories\
pandas.CategoricalIndex.set_categories\
pandas.DataFrame.astype\
pandas.DataFrame.at_time\
Expand Down
7 changes: 4 additions & 3 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,14 +1064,14 @@ def set_categories(
On the other hand this methods does not do checks (e.g., whether the
old categories are included in the new categories on a reorder), which
can result in surprising changes, for example when using special string
dtypes, which does not considers a S1 string equal to a single char
dtypes, which do not consider a S1 string equal to a single char
python string.

Parameters
----------
new_categories : Index-like
The categories in new order.
ordered : bool, default False
ordered : bool, default None
Whether or not the categorical is treated as a ordered categorical.
If not given, do not change the ordered information.
rename : bool, default False
Expand All @@ -1080,7 +1080,8 @@ def set_categories(

Returns
-------
Categorical with reordered categories.
Categorical
New categories to be used, with optional ordering changes.

Raises
------
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,8 @@ def to_numpy(
Returns
-------
numpy.ndarray
The NumPy ndarray holding the values from this Series or Index.
The dtype of the array may differ. See Notes.

See Also
--------
Expand Down