Del via


contains (Column)

Check if a string column contains a substring.

Syntax

contains(other)

Parameters

Parameter Type Description
other str or Column String or Column containing the substring to search for

Returns

Column (boolean)

Examples

df = spark.createDataFrame(
     [(2, "Alice"), (5, "Bob")], ["age", "name"])
df.filter(df.name.contains('o')).collect()
# [Row(age=5, name='Bob')]