Pular para o conteúdo principal

termina com (Coluna)

Verificar se uma coluna de strings termina com uma substring.

Sintaxe

Python
endswith(other)

Parâmetros

Parâmetro

Tipo

Descrição

other

str ou Coluna

strings ou coluna contendo o sufixo a ser verificado

Devoluções

Coluna (Booleana)

Exemplos

Python
df = spark.createDataFrame(
[(2, "Alice"), (5, "Bob")], ["age", "name"])
df.filter(df.name.endswith('ice')).collect()
Output
# [Row(age=2, name='Alice')]
Python
df.filter(df.name.endswith('ice$')).collect()
Output
# []