Skip to content

Inconsistent isin with strings #4763

Closed
@cpcloud

Description

@cpcloud
In [5]: s = Series(list('abc'))

In [6]: s.isin('a')
Out[6]:
0     True
1    False
2    False
dtype: bool

In [5]: s = Series(list('abc'))

In [6]: s.isin('a')
Out[6]:
0     True
1    False
2    False
dtype: bool

In [7]: s = Series(['aaa', 'b', 'c'])

In [8]: s.isin('aaa')
Out[8]:
0    False
1    False
2    False
dtype: bool

I would expect:

In [7]: s = Series(['aaa', 'b', 'c'])

In [8]: s.isin('aaa')
Out[8]:
0    True
1    False
2    False
dtype: bool

or a raise....but raising seems inconsistent with the fact that single strings work....

this is happening bc the iterable passed in is turned into a set which is why a single string works

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions