Skip to content

LazyColumn.isin

isin

isin(*cols: Any) -> LazyColumn

Checks whether the values in this column are contained in a specified set of values.

This method is similar to pandas.Series.isin. It can accept multiple values separated by commas or a single iterable (like a list, set, or tuple).

Parameters:

Name Type Description Default
*cols Any

Values or collections of values to be checked for containment. Can be a list, tuple, or multiple values passed separately.

()

Returns:

Name Type Description
LazyColumn LazyColumn

A new LazyColumn of boolean values, where True indicates that the value is present in cols and False otherwise.

Examples:

print(df.head())
#    col1  my_column_to_test
# 0     1                  3
# 1     2                  4
# 2     3                  6
# 3     4                  8
# 4     5                  3

# Checking if values are in {3, 8}
df["my_column_to_test"].isin(3, 8)
# Expected output (LazyColumn in lazy mode):
# [True, False, False, True, True]

# Checking if values are in a list [4, 6]
df["my_column_to_test"].isin([4, 6])
# [False, True, True, False, False]