se termine par (Colonne)
Vérifiez si une colonne de chaîne se termine par une sous-chaîne.
Syntaxe
Python
endswith(other)
parameter
parameter | Type | Description |
|---|---|---|
| str or Column | String ou colonne contenant le suffixe à vérifier |
Renvoie
Colonne (booléen)
Exemples
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
# []