pyspark.sql.Column.like

Column.like(other: str) → pyspark.sql.column.Column[source]

SQL like expression. Returns a boolean Column based on a SQL LIKE match.

Changed in version 3.4.0: Supports Spark Connect.

Parameters
otherstr

a SQL LIKE pattern

Returns
Column

Column of booleans showing whether each element in the Column is matched by SQL LIKE pattern.

Examples

>>> df = spark.createDataFrame(
...      [(2, "Alice"), (5, "Bob")], ["age", "name"])
>>> df.filter(df.name.like('Al%')).collect()
[Row(age=2, name='Alice')]