contém (Coluna)
Verificar se uma coluna de strings contém uma substring.
Sintaxe
Python
contains(other)
Parâmetros
Parâmetro | Tipo | Descrição |
|---|---|---|
| str ou Coluna | strings ou coluna contendo a substring a ser pesquisada |
Devoluções
Coluna (Booleana)
Exemplos
Python
df = spark.createDataFrame(
[(2, "Alice"), (5, "Bob")], ["age", "name"])
df.filter(df.name.contains('o')).collect()
Output
# [Row(age=5, name='Bob')]