começa com (Coluna)

Verifica se uma coluna de strings começa com uma substring.

Sintaxe

startswith(other)

Parâmetros

Parâmetro Tipo Descrição
other str ou Column String ou Coluna contendo o prefixo para verificar

Devoluções

Coluna (booleana)

Exemplos

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