pyspark.sql.Column.isin

Column.isin(*cols: Any) → pyspark.sql.column.Column[source]

A boolean expression that is evaluated to true if the value of this expression is contained by the evaluated values of the arguments.

New in version 1.5.0.

Examples

>>> df[df.name.isin("Bob", "Mike")].collect()
[Row(age=5, name='Bob')]
>>> df[df.age.isin([1, 2, 3])].collect()
[Row(age=2, name='Alice')]