From 3231cc7014fe1a2db227bb754fe928a4ee92a87e Mon Sep 17 00:00:00 2001 From: KeiOshima Date: Sun, 21 Apr 2024 13:17:19 -0400 Subject: [PATCH 1/2] DOC: fixing SA01 errors for Index: name, dtype, and equals --- ci/code_checks.sh | 3 --- pandas/core/indexes/base.py | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index d1cdff8f7f56b..4ee654e09294d 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -150,10 +150,8 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Index.drop_duplicates RT03" \ -i "pandas.Index.droplevel RT03,SA01" \ -i "pandas.Index.dropna RT03,SA01" \ - -i "pandas.Index.dtype SA01" \ -i "pandas.Index.duplicated RT03" \ -i "pandas.Index.empty GL08" \ - -i "pandas.Index.equals SA01" \ -i "pandas.Index.fillna RT03" \ -i "pandas.Index.get_indexer PR07,SA01" \ -i "pandas.Index.get_indexer_for PR01,SA01" \ @@ -169,7 +167,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -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" \ diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 8ede401f37184..b1466f5fead37 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -976,6 +976,10 @@ def dtype(self) -> DtypeObj: """ Return the dtype object of the underlying data. + See Also + -------- + Index.inferred_type: Return a string of the type inferred from the values. + Examples -------- >>> idx = pd.Index([1, 2, 3]) @@ -1638,6 +1642,11 @@ def name(self) -> Hashable: """ Return Index or MultiIndex name. + See Also + -------- + Index.set_names: Able to set new names partially and by level. + Index.rename: Able to set new names partially and by level. + Examples -------- >>> idx = pd.Index([1, 2, 3], name="x") @@ -5174,6 +5183,12 @@ def equals(self, other: Any) -> bool: bool True if "other" is an Index and it has the same elements and order as the calling index; False otherwise. + + See Also + -------- + Index.identical: Checks that object attributes and types are also equal. + Index.has_duplicates: Check if the Index has duplicate values. + Index.is_unique: Return if the index has unique values. Examples -------- From 9d91e5da8f02a9f0426997dac957af339a78f812 Mon Sep 17 00:00:00 2001 From: KeiOshima Date: Sun, 21 Apr 2024 13:26:49 -0400 Subject: [PATCH 2/2] fixing Blank line contains whitespace error --- pandas/core/indexes/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index b1466f5fead37..5b8ba20c14f74 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -5183,7 +5183,7 @@ def equals(self, other: Any) -> bool: bool True if "other" is an Index and it has the same elements and order as the calling index; False otherwise. - + See Also -------- Index.identical: Checks that object attributes and types are also equal.