Menu Close

How to determine whether a Python Pandas Column contains a particular value?

To determine whether a Python Pandas Column contains a particular value, we can use the in operator.

For instance, we write

s = pd.Series(list('abc'))
1 in s

to create a series with 'a', 'b', and 'c' as its values.

And then we can check if 1 is in the series s with 1 in s.

Posted in Python, Python Answers