Pular para o conteúdo principal

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

other

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
# []