From 5895769989cb371dbbca1f47b88b7fe15ea4c740 Mon Sep 17 00:00:00 2001 From: shriyakalakata Date: Sat, 27 Apr 2024 11:51:33 -0400 Subject: [PATCH 1/2] Fix errors for Index.append --- ci/code_checks.sh | 1 - pandas/core/indexes/base.py | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 26c8ae1298630..5e998d166f32b 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -104,7 +104,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.DatetimeIndex.to_pydatetime RT03,SA01" \ -i "pandas.Grouper PR02" \ -i "pandas.Index PR07" \ - -i "pandas.Index.append PR07,RT03,SA01" \ -i "pandas.Index.difference PR07,RT03,SA01" \ -i "pandas.Index.drop PR07,SA01" \ -i "pandas.Index.duplicated RT03" \ diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 9acab2642f6be..ad236bd548d60 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -5111,10 +5111,18 @@ def append(self, other: Index | Sequence[Index]) -> Index: Parameters ---------- other : Index or list/tuple of indices + Single Index or a collection of indices, which can be either a list or a + tuple. Returns ------- Index + Returns a new Index object resulting from appending the provided other + indices to the original Index. + + See Also + -------- + Index.insert : Make new Index inserting new item at location. Examples -------- From e050960614d422383885ab8247ae868902a053bb Mon Sep 17 00:00:00 2001 From: shriyakalakata Date: Sat, 27 Apr 2024 12:12:20 -0400 Subject: [PATCH 2/2] Fixed errors for Index.difference --- ci/code_checks.sh | 1 - pandas/core/indexes/base.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 5e998d166f32b..c2e4b0054c686 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -104,7 +104,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.DatetimeIndex.to_pydatetime RT03,SA01" \ -i "pandas.Grouper PR02" \ -i "pandas.Index PR07" \ - -i "pandas.Index.difference PR07,RT03,SA01" \ -i "pandas.Index.drop PR07,SA01" \ -i "pandas.Index.duplicated RT03" \ -i "pandas.Index.get_indexer PR07,SA01" \ diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index ad236bd548d60..23364eb9b6d33 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -3228,6 +3228,8 @@ def difference(self, other, sort=None): Parameters ---------- other : Index or array-like + Index object or an array-like object containing elements to be compared + with the elements of the original Index. sort : bool or None, default None Whether to sort the resulting index. By default, the values are attempted to be sorted, but any TypeError from @@ -3241,6 +3243,14 @@ def difference(self, other, sort=None): Returns ------- Index + Returns a new Index object containing elements that are in the original + Index but not in the `other` Index. + + See Also + -------- + Index.symmetric_difference : Compute the symmetric difference of two Index + objects. + Index.intersection : Form the intersection of two Index objects. Examples --------