From 284593b7168822ca457640e615ce50cbd87eded1 Mon Sep 17 00:00:00 2001 From: shriyakalakata <87483933+shriyakalakata@users.noreply.github.com> Date: Mon, 22 Apr 2024 12:29:47 -0400 Subject: [PATCH] DOC: Fix SA01 errors for Index.hasnans, Index.map, Index.nbytes (#58343) * Shorten sentence length * Remove Series.nbytes from ci/code_checks.sh * Update see also method names * Update see also method names * Update see also methods for Index.map * Update method descriptions --- ci/code_checks.sh | 4 ---- pandas/core/base.py | 5 +++++ pandas/core/indexes/base.py | 10 ++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index cabc25b5e0ba5..4debc2eb91449 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -156,18 +156,15 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Index.get_indexer_non_unique PR07,SA01" \ -i "pandas.Index.get_loc PR07,RT03,SA01" \ -i "pandas.Index.get_slice_bound PR07" \ - -i "pandas.Index.hasnans SA01" \ -i "pandas.Index.identical PR01,SA01" \ -i "pandas.Index.inferred_type SA01" \ -i "pandas.Index.insert PR07,RT03,SA01" \ -i "pandas.Index.intersection PR07,RT03,SA01" \ -i "pandas.Index.item SA01" \ -i "pandas.Index.join PR07,RT03,SA01" \ - -i "pandas.Index.map SA01" \ -i "pandas.Index.memory_usage RT03" \ -i "pandas.Index.name SA01" \ -i "pandas.Index.names GL08" \ - -i "pandas.Index.nbytes SA01" \ -i "pandas.Index.nunique RT03" \ -i "pandas.Index.putmask PR01,RT03" \ -i "pandas.Index.ravel PR01,RT03" \ @@ -344,7 +341,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.mod PR07" \ -i "pandas.Series.mode SA01" \ -i "pandas.Series.mul PR07" \ - -i "pandas.Series.nbytes SA01" \ -i "pandas.Series.ne PR07,SA01" \ -i "pandas.Series.nunique RT03" \ -i "pandas.Series.pad PR01,SA01" \ diff --git a/pandas/core/base.py b/pandas/core/base.py index 9b1251a4ef5d8..424f0609dd485 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -419,6 +419,11 @@ def nbytes(self) -> int: """ Return the number of bytes in the underlying data. + See Also + -------- + Series.ndim : Number of dimensions of the underlying data. + Series.size : Return the number of elements in the underlying data. + Examples -------- For Series: diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 8ede401f37184..d1d1c5ea3171f 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -2423,6 +2423,12 @@ def hasnans(self) -> bool: ------- bool + See Also + -------- + Index.isna : Detect missing values. + Index.dropna : Return Index without NA/NaN values. + Index.fillna : Fill NA/NaN values with the specified value. + Examples -------- >>> s = pd.Series([1, 2, 3], index=["a", "b", None]) @@ -6067,6 +6073,10 @@ def map(self, mapper, na_action: Literal["ignore"] | None = None): If the function returns a tuple with more than one element a MultiIndex will be returned. + See Also + -------- + Index.where : Replace values where the condition is False. + Examples -------- >>> idx = pd.Index([1, 2, 3])