-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
Error ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionisinisin methodisin method
Description
Right now we can compare a Series with a DataFrame through Series.isin
, but is this expected / wanted behaviour?
I would say this should raise, since expectations can be pretty ambiguous here and is confusing to me.
Also the documentation right now states that the values
parameter should be "set or list-like"
Code example:
values = list("ABCD")
s = pd.Series(values)
df = pd.DataFrame({"Column": values})
print(s)
0 A
1 B
2 C
3 D
dtype: object
print(df)
Column
0 A
1 B
2 C
3 D
# comparing DataFrame to Series, this is okay (right?) and I understand the result
df.isin(s)
Column
0 True
1 True
2 True
3 True
# comparing a series to df, what do we expect here? Should this raise? Why do you want to compare a Series to a DataFrame?
s.isin(df)
0 False
1 False
2 False
3 False
dtype: bool
Proposal: when passing anything else than "set or list-like" should raise in Series.isin
Metadata
Metadata
Assignees
Labels
Error ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionisinisin methodisin method