Skip to content

DOC Fix EX01 issues in docstrings #51533

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 1 commit into from
Feb 21, 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 @@ -86,10 +86,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.index \
pandas.Series.nbytes \
pandas.Series.ndim \
pandas.Series.size \
pandas.Series.T \
pandas.Series.hasnans \
pandas.Series.to_list \
pandas.Series.__iter__ \
Expand Down
47 changes: 47 additions & 0 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,20 @@ def transpose(self: _T, *args, **kwargs) -> _T:
transpose,
doc="""
Return the transpose, which is by definition self.

Examples
--------
>>> s = pd.Series(['Ant', 'Bear', 'Cow'])
>>> s
0 Ant
1 Bear
2 Cow
dtype: object
>>> s.T
0 Ant
1 Bear
2 Cow
dtype: object
""",
)

Expand All @@ -325,6 +339,17 @@ def __len__(self) -> int:
def ndim(self) -> Literal[1]:
"""
Number of dimensions of the underlying data, by definition 1.

Examples
--------
>>> s = pd.Series(['Ant', 'Bear', 'Cow'])
>>> s
0 Ant
1 Bear
2 Cow
dtype: object
>>> s.ndim
1
"""
return 1

Expand All @@ -351,13 +376,35 @@ def item(self):
def nbytes(self) -> int:
"""
Return the number of bytes in the underlying data.

Examples
--------
>>> s = pd.Series(['Ant', 'Bear', 'Cow'])
>>> s
0 Ant
1 Bear
2 Cow
dtype: object
>>> s.nbytes
24
"""
return self._values.nbytes

@property
def size(self) -> int:
"""
Return the number of elements in the underlying data.

Examples
--------
>>> s = pd.Series(['Ant', 'Bear', 'Cow'])
>>> s
0 Ant
1 Bear
2 Cow
dtype: object
>>> s.size
3
"""
return len(self._values)

Expand Down