Skip to content

Commit

Permalink
DOC: Enforce Numpy Docstring Validation for pandas.Series (pandas-dev…
Browse files Browse the repository at this point in the history
…#58537)

* add see also section for pandas.Series.cat

* fix docstring errors for pandas.Series.__iter__

* remove 'pandas' from see also

* Improve See Also

Co-authored-by: Matthew Roeschke <[email protected]>

* Improve See Also

---------

Co-authored-by: Matthew Roeschke <[email protected]>
  • Loading branch information
gboeker and mroeschke authored May 3, 2024
1 parent 3829c94 commit b4d3309
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 1 addition & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,9 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.RangeIndex.start SA01" \
-i "pandas.RangeIndex.step SA01" \
-i "pandas.RangeIndex.stop SA01" \
-i "pandas.Series.__iter__ RT03,SA01" \
-i "pandas.Series.add PR07" \
-i "pandas.Series.case_when RT03" \
-i "pandas.Series.cat PR07,SA01" \
-i "pandas.Series.cat PR07" \
-i "pandas.Series.cat.add_categories PR01,PR02" \
-i "pandas.Series.cat.as_ordered PR01" \
-i "pandas.Series.cat.as_unordered PR01" \
Expand Down
7 changes: 6 additions & 1 deletion pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ def add_categories(self, new_categories) -> Self:
Parameters
----------
new_categories : category or list-like of category
The new categories to be included.
The new categories to be included.
Returns
-------
Expand Down Expand Up @@ -2864,6 +2864,11 @@ class CategoricalAccessor(PandasDelegate, PandasObject, NoNewAttributesMixin):
----------
data : Series or CategoricalIndex
See Also
--------
Series.dt : Accessor object for datetimelike properties of the Series values.
Series.sparse : Accessor for sparse matrix data types.
Examples
--------
>>> s = pd.Series(list("abbccc")).astype("category")
Expand Down
5 changes: 5 additions & 0 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,11 @@ def __iter__(self) -> Iterator:
Returns
-------
iterator
An iterator yielding scalar values from the Series.
See Also
--------
Series.items : Lazily iterate over (index, value) tuples.
Examples
--------
Expand Down

0 comments on commit b4d3309

Please sign in to comment.