começa com (Coluna)
Verifique se uma coluna de strings começa com uma substring.
Sintaxe
Python
startswith(other)
Parâmetros
Parâmetro | Tipo | Descrição |
|---|---|---|
| str ou Coluna | strings ou coluna contendo o prefixo a ser verificado |
Devoluções
Coluna (Booleana)
Exemplos
Python
df = spark.createDataFrame(
[(2, "Alice"), (5, "Bob")], ["age", "name"])
df.filter(df.name.startswith('Al')).collect()
Output
# [Row(age=2, name='Alice')]
Python
df.filter(df.name.startswith('^Al')).collect()
Output
# []