Skip to content

DOC: Fix EX01 issues in docstrings #52966

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 6 commits into from
Apr 27, 2023
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
4 changes: 0 additions & 4 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then

MSG='Partially validate docstrings (EX01)' ; echo $MSG
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX01 --ignore_functions \
pandas.Series.__iter__ \
pandas.Series.keys \
pandas.Series.item \
pandas.Series.pipe \
pandas.Series.mode \
Expand Down Expand Up @@ -533,8 +531,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.api.extensions.ExtensionArray.shape \
pandas.api.extensions.ExtensionArray.tolist \
pandas.DataFrame.columns \
pandas.DataFrame.__iter__ \
pandas.DataFrame.keys \
pandas.DataFrame.iterrows \
pandas.DataFrame.pipe \
pandas.DataFrame.backfill \
Expand Down
9 changes: 9 additions & 0 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,15 @@ def __iter__(self) -> Iterator:
Returns
-------
iterator

Examples
--------
>>> s = pd.Series([1, 2, 3])
>>> for x in s:
... print(x)
1
2
3
"""
# We are explicitly making element iterators.
if not isinstance(self._values, np.ndarray):
Expand Down
20 changes: 20 additions & 0 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1900,6 +1900,14 @@ def __iter__(self) -> Iterator:
-------
iterator
Info axis as iterator.

Examples
--------
>>> df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
>>> for x in df:
... print(x)
A
B
"""
return iter(self._info_axis)

Expand All @@ -1914,6 +1922,18 @@ def keys(self) -> Index:
-------
Index
Info axis.

Examples
--------
>>> d = pd.DataFrame(data={'A': [1, 2, 3], 'B': [0, 4, 8]},
... index=['a', 'b', 'c'])
>>> d
A B
a 1 0
b 2 4
c 3 8
>>> d.keys()
Index(['A', 'B'], dtype='object')
"""
return self._info_axis

Expand Down
6 changes: 6 additions & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,12 @@ def keys(self) -> Index:
-------
Index
Index of the Series.

Examples
--------
>>> s = pd.Series([1, 2, 3], index=[0, 1, 2])
>>> s.keys()
Index([0, 1, 2], dtype='int64')
"""
return self.index

Expand Down