Skip to content
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

DOC: fixing SA01 error for Index: T and empty #58430

Merged
merged 2 commits into from
Apr 25, 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
4 changes: 0 additions & 4 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.DatetimeTZDtype.tz SA01" \
-i "pandas.Grouper PR02" \
-i "pandas.Index PR07" \
-i "pandas.Index.T SA01" \
-i "pandas.Index.append PR07,RT03,SA01" \
-i "pandas.Index.copy PR07,SA01" \
-i "pandas.Index.difference PR07,RT03,SA01" \
Expand All @@ -122,7 +121,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Index.droplevel RT03,SA01" \
-i "pandas.Index.dropna RT03,SA01" \
-i "pandas.Index.duplicated RT03" \
-i "pandas.Index.empty GL08" \
-i "pandas.Index.get_indexer PR07,SA01" \
-i "pandas.Index.get_indexer_for PR01,SA01" \
-i "pandas.Index.get_indexer_non_unique PR07,SA01" \
Expand Down Expand Up @@ -234,7 +232,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.RangeIndex.step SA01" \
-i "pandas.RangeIndex.stop SA01" \
-i "pandas.Series SA01" \
-i "pandas.Series.T SA01" \
-i "pandas.Series.__iter__ RT03,SA01" \
-i "pandas.Series.add PR07" \
-i "pandas.Series.at_time PR01" \
Expand Down Expand Up @@ -275,7 +272,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Series.dt.tz_localize PR01,PR02" \
-i "pandas.Series.dt.unit GL08" \
-i "pandas.Series.dtype SA01" \
-i "pandas.Series.empty GL08" \
-i "pandas.Series.eq PR07,SA01" \
-i "pandas.Series.floordiv PR07" \
-i "pandas.Series.ge PR07,SA01" \
Expand Down
38 changes: 38 additions & 0 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ def transpose(self, *args, **kwargs) -> Self:
doc="""
Return the transpose, which is by definition self.

See Also
--------
Index : Immutable sequence used for indexing and alignment.

Examples
--------
For Series:
Expand Down Expand Up @@ -691,6 +695,40 @@ def to_numpy(
@final
@property
def empty(self) -> bool:
"""
Indicator whether Index is empty.

Returns
-------
bool
If Index is empty, return True, if not return False.

See Also
--------
Index.size : Return the number of elements in the underlying data.

Examples
--------
>>> idx_empty = pd.Index([1, 2, 3])
>>> idx_empty
Index([1, 2, 3], dtype='int64')
>>> idx_empty.empty
False

>>> idx_empty = pd.Index([])
>>> idx_empty
Index([], dtype='object')
>>> idx_empty.empty
True

If we only have NaNs in our DataFrame, it is not considered empty!

>>> idx_empty = pd.Index([np.nan, np.nan])
>>> idx_empty
Index([nan, nan], dtype='float64')
>>> idx_empty.empty
False
"""
return not self.size

@doc(op="max", oppose="min", value="largest")
Expand Down