-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
DocsIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team member
Milestone
Description
Add notin convenience method to DataFrame/Series classes
This may already have been discussed, but I couldn't find any existing issue/enhancement with this title.
It's trivial to implement, but I think it might be syntactically helpful to write
df.notin(df1)instead of
~df.isin(df1)especially in longer expressions where the boolean array is being used to slice a dataframe.
Describe the solution you'd like
Add a convenience function which returns the not value of df.isin
API breaking implications
No impact on API.
Additional context
This has already been done for isna/notna, and I find it very helpful—just borrowing the same idea.
Copied from frame.py:
@doc(NDFrame.isna, klass=_shared_doc_kwargs["klass"])
def isna(self) -> DataFrame:
result = self._constructor(self._mgr.isna(func=isna))
return result.__finalize__(self, method="isna")
@doc(NDFrame.notna, klass=_shared_doc_kwargs["klass"])
def notna(self) -> DataFrame:
return ~self.isna()Metadata
Metadata
Assignees
Labels
DocsIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team member