1

I can easily check whether each is equal to a number:

In [20]: s = pd.Series([1, 2, 3]) In [21]: s == 1 Out[21]: 0 True 1 False 2 False 

My problem is, is there a function like s._in([1, 2]) and output something like

0 True 1 True 2 False 

1 Answer 1

4

Yes, it is called isin. Do s.isin([1, 2]).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.