Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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')]